vb6 Posted April 17, 2009 at 06:12 PM Report #257348 Posted April 17, 2009 at 06:12 PM eu queria saber como fazer ao escolher um item de uma combobox mostrar todos os dados correspondentes dessa combobox....mostrar os registos nas textbox desse item
jpaulino Posted April 17, 2009 at 06:17 PM Report #257350 Posted April 17, 2009 at 06:17 PM Vê se é isto que queres fazer:
vb6 Posted April 17, 2009 at 07:02 PM Author Report #257355 Posted April 17, 2009 at 07:02 PM Aparece isto quando vou para abrir a form "Object reference not set to an instance of an object." :dontgetit:
jpaulino Posted April 17, 2009 at 07:14 PM Report #257357 Posted April 17, 2009 at 07:14 PM A fechar ? Onde ?
vb6 Posted April 17, 2009 at 09:24 PM Author Report #257375 Posted April 17, 2009 at 09:24 PM Dim dr As DataRow = Me.TestDataSet.Users.Rows.Find(Me.ComboBox1.SelectedValue) dá me erro nessa linha
jpaulino Posted April 17, 2009 at 11:16 PM Report #257400 Posted April 17, 2009 at 11:16 PM Só se for contigo! Acabei de testar e funciona bem ... e este exemplo foi feito para outro lado e também está a funcionar. Alteraste alguma coisa ?
vb6 Posted April 20, 2009 at 04:58 PM Author Report #257790 Posted April 20, 2009 at 04:58 PM Private Sub Filmes_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'TODO: This line of code loads data into the 'Clube_de_videoDataSet1.Actores' table. You can move, or remove it, as needed. Me.ActoresTableAdapter.Fill(Me.Clube_de_videoDataSet1.Actores) 'TODO: This line of code loads data into the 'Clube_de_videoDataSet1.Realizadores' table. You can move, or remove it, as needed. Me.RealizadoresTableAdapter.Fill(Me.Clube_de_videoDataSet1.Realizadores) 'TODO: This line of code loads data into the 'Clube_de_videoDataSet1.Filmes' table. You can move, or remove it, as needed. Me.FilmesTableAdapter1.Fill(Me.Clube_de_videoDataSet1.Filmes) Me.CategoriaComboBox.SelectedIndex = -1 Me.CategoriaComboBox.DropDownStyle = ComboBoxStyle.DropDownList Dim db As New OleDbConnection(clube_de_video.My.Settings.ligacaobd) ' LIGAR A BD db.Open() Dim da As New OleDbDataAdapter("Select Categoria From Categoria", db) Dim ds As New DataSet da.Fill(ds, "Categoria") With Me.CategoriaComboBox .DisplayMember = "Categoria" .ValueMember = "Categoria" .DataSource = ds.Tables(0).DefaultView ' Definições para autocompleta .DropDownStyle = ComboBoxStyle.DropDown .AutoCompleteMode = AutoCompleteMode.Suggest .AutoCompleteSource = AutoCompleteSource.ListItems End With End Sub Private Sub CategoriaComboBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) If Me.CategoriaComboBox.SelectedIndex <> -1 Then Dim dr As DataRow = Me.Clube_de_videoDataSet.Filmes.Rows.Find(Me.CategoriaComboBox.SelectedValue) If dr IsNot Nothing Then Me.ID_FilmeTextBox.Text = dr.Item(0).ToString Me.ID_RealizadorComboBox.Text = dr.Item(1).ToString Me.ID_ActorComboBox.Text = dr.Item(2).ToString Me.CategoriaComboBox.Text = dr.Item(3).ToString Me.NomeTextBox.Text = dr.Item(4).ToString Me.Ano_EstreiaTextBox.Text = dr.Item(5).ToString Me.AutorTextBox.Text = dr.Item(6).ToString End If End If End Sub
vb6 Posted April 20, 2009 at 05:00 PM Author Report #257792 Posted April 20, 2009 at 05:00 PM o codigo é esse
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now