mybb_smilies to picturebox - Printable Version +- Red Security (https://redsecurity.info/cc) +-- Forum: Programming (https://redsecurity.info/cc/forumdisplay.php?fid=5) +--- Forum: Visual Basic & .NET Framework (https://redsecurity.info/cc/forumdisplay.php?fid=17) +--- Thread: mybb_smilies to picturebox (/showthread.php?tid=102) |
mybb_smilies to picturebox - viruss - 07-27-2017 Here is mybb_smilies to picturebox from Sid number to image location whats needed 2 textboxes 1 datagridview item and 2 button here is code code is pretty much the same as mysql browser oonly difference therte is picturbox code added to display image from data base to pictuirebox Code Starts Here form1.vb code Imports MySql.Data.MySqlClient Imports System Imports System.Security.Cryptography Imports System.Text Public Class Form1 Dim cmd As New MySqlCommand Dim da As New MySqlDataAdapter Public total As Integer Dim publictable As New DataTable 'declare conn as connection and it will now a new connection because 'it is equal to Getconnection Function Dim con As MySqlConnection = jokenconn() Public Function jokenconn() As MySqlConnection Return New MySqlConnection("server=dbname;user id=mybb;password=your-password-here;database=mybb") End Function Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim publictable As New DataTable Dim sql As String sql = TextBox1.Text Try 'bind the connection and query With cmd .Connection = con .CommandText = sql End With 'Gets or sets a Transact-SQL statement or stored procedure used to select records in the data source. da.SelectCommand = cmd da.Fill(publictable) 'get the datasource from publictable and passed to datagridview DataGridView1.DataSource = publictable 'dispose the dataadapter da.Dispose() Catch ex As Exception MsgBox(ex.Message) End Try con.Close() da.Dispose() End Sub Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load TextBox1.BorderStyle = BorderStyle.None TextBox1.Text = "select * from mybb_smilies" Button1.PerformClick() Me.WindowState = FormWindowState.Maximized End Sub 'new code start here Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click Dim publictable As New DataTable Dim sql As String sql = TextBox1.Text Try 'bind the connection and query With cmd .Connection = con .CommandText = sql End With 'Gets or sets a Transact-SQL statement or stored procedure used to select records in the data source. da.SelectCommand = cmd da.Fill(publictable) 'get the datasource from publictable and passed to datagridview PictureBox1.ImageLocation = RichTextBox1.Text RichTextBox1.Text = " Site url here /forum/" & DataGridView1.CurrentRow.Cells(0).Value.ToString '// column 1." 'dispose the dataadapter da.Dispose() Catch ex As Exception MsgBox(ex.Message) End Try con.Close() da.Dispose() End Sub End Class image RE: mybb_smilies to picturebox - Mr.Kurd - 09-21-2017 Wow I didn't see this, Thank you my bro |