Jalar informacion de un combobox
Tengo uan aplicasion en visual basic .net de la cual necesito jalar informacion para un textbox desde un combobox mi codigo es el sigiente pero este me genera un error
Imports System. Data
Imports System. Data. SqlClient
Public Class estudios
Dim DS As New DataSet()
Dim aEstudios As SqlDataAdapter
Dim WithEvents bEstudios As New BindingSource
Private Sub estudios_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
aEstudios = New SqlDataAdapter("SELECT * FROM Estudios", "Initial Catalog=Sisma; Data Source=.;Integrated Security=True")
aEstudios.Fill(DS, "Estudio")
bEstudios.DataSource = DS.Tables("Estudio")
ComboBox1.DataSource = bEstudios
BindingNavigator1.BindingSource = bEstudios
ComboBox1.DisplayMember = DS.Tables(0).Columns(2).Caption.ToString
ComboBox1.ValueMember = DS.Tables(0).Columns(1).Caption.ToString
ComboBox1.DataBindings.Add(New Binding("Text", bEstudios, "NombreEstudio"))
TextBox1.DataBindings.Add(New Binding("Text", bEstudios, "TipoEstudio"))
RichTextBox1.DataBindings.Add(New Binding("Text", bEstudios, "Descripcion"))
Dim CB As New SqlCommandBuilder(aEstudios)
End Sub
Imports System. Data
Imports System. Data. SqlClient
Public Class estudios
Dim DS As New DataSet()
Dim aEstudios As SqlDataAdapter
Dim WithEvents bEstudios As New BindingSource
Private Sub estudios_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
aEstudios = New SqlDataAdapter("SELECT * FROM Estudios", "Initial Catalog=Sisma; Data Source=.;Integrated Security=True")
aEstudios.Fill(DS, "Estudio")
bEstudios.DataSource = DS.Tables("Estudio")
ComboBox1.DataSource = bEstudios
BindingNavigator1.BindingSource = bEstudios
ComboBox1.DisplayMember = DS.Tables(0).Columns(2).Caption.ToString
ComboBox1.ValueMember = DS.Tables(0).Columns(1).Caption.ToString
ComboBox1.DataBindings.Add(New Binding("Text", bEstudios, "NombreEstudio"))
TextBox1.DataBindings.Add(New Binding("Text", bEstudios, "TipoEstudio"))
RichTextBox1.DataBindings.Add(New Binding("Text", bEstudios, "Descripcion"))
Dim CB As New SqlCommandBuilder(aEstudios)
End Sub
1 Respuesta
Respuesta de Omar Aguiar
1