Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged 'tb_sno.Enabled = False tb_name.Enabled = False cb_school.Enabled = False 'cb_doctype.Enabled = False Dim test As String = ListBox1.Text tb_sno.Text = ListBox1.Text.Remove(ListBox1.Text.IndexOf(" ")) If con.State <> ConnectionState.Open Then con.Open() End If GroupBox3.Visible = True Dim dr As SqlDataReader Dim sid As String sid = ComboBox1.SelectedItem.ToString sid = sid.Substring(0, 9) ' school = ComboBox2.Text 'dname = ListBox1.Items.Add(dr(0)) Dim cmd As New SqlCommand("select * from studentmaster a, hbetscan b where a.studentid='" & sid & "' and a.studentid=b.studentid ", con) cmd.CommandTimeout = 0 cmd.ExecuteNonQuery() dr = cmd.ExecuteReader If dr.Read Then tb_sid.Text = dr("studentid") tb_name.Text = dr("studentname") cb_school.Text = dr("schoolname") cb_doctype.Text = dr("doctype") Dim imgdata() As Byte = dr("image") Dim img As Image Dim ms As MemoryStream = New MemoryStream(imgdata, 0, imgdata.Length) ms.Write(imgdata, 0, imgdata.Length) img = Image.FromStream(ms, True) PictureBox1.Image = img PictureBox1.Image.Save("c:\" & "img1.jpg", System.Drawing.Imaging.ImageFormat.Jpeg) dr.Close() con.Close() ms.Close() 'ms.Dispose() End If End Sub
tb_name.Enabled = False
sid
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)