HighTechTalks DotNet Forums  

BindingNavigator items won't work

Dotnet Data Tools microsoft.public.dotnet.datatools


Discuss BindingNavigator items won't work in the Dotnet Data Tools forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
cyclops@unet.nl
 
Posts: n/a

Default BindingNavigator items won't work - 02-22-2007 , 01:11 PM






Hi All,

I've got a database with several tables in it. Each table has got the
same columns (name, type etc.)
On my form, I want to show the records of a selected table (selected
in a combobox) in corresponding textboxes. The bindingnavigator should
then allow you to move through the records, or should it not? Probably
not, because on my form it doesn't work!

Look at my code below:

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

ComboBox1.Items.Add(CyclopsDataSet.TableA.TableNam e)
ComboBox1.Items.Add(CyclopsDataSet.TableB.TableNam e)
ComboBox1.Items.Add(CyclopsDataSet.TableC.TableNam e)


End Sub

Private Sub ComboBox1_TextChanged(ByVal sender As Object, ByVal e
As System.EventArgs) Handles ComboBox1.TextChanged

TextStartnr.DataBindings.Clear()
TextVoor.DataBindings.Clear()
TextAchter.DataBindings.Clear()
TextNatio.DataBindings.Clear()
TextType.DataBindings.Clear()


Select Case ComboBox1.Text
Case "TableA"

'bindingsource should be set. if this is [none] the
bindingnavigator is disabled
Me.BindingNavigator1.BindingSource = Me.BindingSource1

'setting the datamember which corresponds with the
selected table
BindingSource1.DataMember = "TableA"

'binding of columns with the textboxes
TextStartnr.DataBindings.Add(New Binding("Text",
CyclopsDataSet, "TableA.Startnummer"))
TextVoor.DataBindings.Add(New Binding("Text",
CyclopsDataSet, "TableA.Voornaam"))
TextAchter.DataBindings.Add(New Binding("Text",
CyclopsDataSet, "TableA.Achternaam"))
TextNatio.DataBindings.Add(New Binding("Text",
CyclopsDataSet, "TableA.Nationaliteit"))
TextType.DataBindings.Add(New Binding("Text",
CyclopsDataSet, "TableA.Type"))

'filling the tableadapter
Me.TableATableAdapter.Fill(Me.CyclopsDataSet.Table A)

Case "TableB"
BindingSource1.DataMember = "TableB"

TextStartnr.DataBindings.Add(New Binding("Text",
CyclopsDataSet, "TableB.Startnummer"))
TextVoor.DataBindings.Add(New Binding("Text",
CyclopsDataSet, "TableB.Voornaam"))
TextAchter.DataBindings.Add(New Binding("Text",
CyclopsDataSet, "TableB.Achternaam"))
TextNatio.DataBindings.Add(New Binding("Text",
CyclopsDataSet, "TableB.Nationaliteit"))
TextType.DataBindings.Add(New Binding("Text",
CyclopsDataSet, "TableB.Typerenner"))

Me.TableBTableAdapter.Fill(Me.CyclopsDataSet.Table B)



Could someone please tell me what I'm doing wrong??
Thanx...


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.