' Main Form *************************************
Public Class Form1
Private Sub TestBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TestBindingNavigatorSaveItem.Click
Me.Validate()
Me.TestBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.WPMlocalDataSet)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'WPMlocalDataSet.test' table. You can move, or remove it, as needed.
Me.TestTableAdapter.Fill(Me.WPMlocalDataSet.test)
'Me.TextBox1.Text = Me.Col2TextBox.Text 'can't use this unless you start on TabPage 2
End Sub
Private Sub BindingNavigatorMoveNextItem_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BindingNavigatorMoveNextItem.Click
Me.TextBox1.Text = Me.Col2TextBox.Text 'This won't work (nor will any events from the BN unless you start on TabPage 2 or click on it first otherwise Col2TextBox.TexT is still empty)
End Sub
End Class
' Designer ********************************************************************************************
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Form1))
Dim IdxLabel As System.Windows.Forms.Label
Dim Col1Label As System.Windows.Forms.Label
Dim Col2Label As System.Windows.Forms.Label
Me.TestBindingNavigator = New System.Windows.Forms.BindingNavigator(Me.components)
Me.BindingNavigatorAddNewItem = New System.Windows.Forms.ToolStripButton
Me.BindingNavigatorCountItem = New System.Windows.Forms.ToolStripLabel
Me.BindingNavigatorDeleteItem = New System.Windows.Forms.ToolStripButton
Me.BindingNavigatorMoveFirstItem = New System.Windows.Forms.ToolStripButton
Me.BindingNavigatorMovePreviousItem = New System.Windows.Forms.ToolStripButton
Me.BindingNavigatorSeparator = New System.Windows.Forms.ToolStripSeparator
Me.BindingNavigatorPositionItem = New System.Windows.Forms.ToolStripTextBox
Me.BindingNavigatorSeparator1 = New System.Windows.Forms.ToolStripSeparator
Me.BindingNavigatorMoveNextItem = New System.Windows.Forms.ToolStripButton
Me.BindingNavigatorMoveLastItem = New System.Windows.Forms.ToolStripButton
Me.BindingNavigatorSeparator2 = New System.Windows.Forms.ToolStripSeparator
Me.TestBindingNavigatorSaveItem = New System.Windows.Forms.ToolStripButton
Me.TabControl1 = New System.Windows.Forms.TabControl
Me.TabPage1 = New System.Windows.Forms.TabPage
Me.TabPage2 = New System.Windows.Forms.TabPage
Me.IdxTextBox = New System.Windows.Forms.TextBox
Me.Col1TextBox = New System.Windows.Forms.TextBox
Me.Col2TextBox = New System.Windows.Forms.TextBox
Me.TestBindingSource = New System.Windows.Forms.BindingSource(Me.components)
Me.WPMlocalDataSet = New TabTestApp.WPMlocalDataSet
Me.TestTableAdapter = New TabTestApp.WPMlocalDataSetTableAdapters.testTableAdapter
Me.TableAdapterManager = New TabTestApp.WPMlocalDataSetTableAdapters.TableAdapterManager
Me.TextBox1 = New System.Windows.Forms.TextBox
IdxLabel = New System.Windows.Forms.Label
Col1Label = New System.Windows.Forms.Label
Col2Label = New System.Windows.Forms.Label
CType(Me.TestBindingNavigator, System.ComponentModel.ISupportInitialize).BeginInit()
Me.TestBindingNavigator.SuspendLayout()
Me.TabControl1.SuspendLayout()
Me.TabPage1.SuspendLayout()
Me.TabPage2.SuspendLayout()
CType(Me.TestBindingSource, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.WPMlocalDataSet, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'TestBindingNavigator
'
Me.TestBindingNavigator.AddNewItem = Me.BindingNavigatorAddNewItem
Me.TestBindingNavigator.BindingSource = Me.TestBindingSource
Me.TestBindingNavigator.CountItem = Me.BindingNavigatorCountItem
Me.TestBindingNavigator.DeleteItem = Me.BindingNavigatorDeleteItem
Me.TestBindingNavigator.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.BindingNavigatorMoveFirstItem, Me.BindingNavigatorMovePreviousItem, Me.BindingNavigatorSeparator, Me.BindingNavigatorPositionItem, Me.BindingNavigatorCountItem, Me.BindingNavigatorSeparator1, Me.BindingNavigatorMoveNextItem, Me.BindingNavigatorMoveLastItem, Me.BindingNavigatorSeparator2, Me.BindingNavigatorAddNewItem, Me.BindingNavigatorDeleteItem, Me.TestBindingNavigatorSaveItem})
Me.TestBindingNavigator.Location = New System.Drawing.Point(0, 0)
Me.TestBindingNavigator.MoveFirstItem = Me.BindingNavigatorMoveFirstItem
Me.TestBindingNavigator.MoveLastItem = Me.BindingNavigatorMoveLastItem
Me.TestBindingNavigator.MoveNextItem = Me.BindingNavigatorMoveNextItem
Me.TestBindingNavigator.MovePreviousItem = Me.BindingNavigatorMovePreviousItem
Me.TestBindingNavigator.Name = "TestBindingNavigator"
Me.TestBindingNavigator.PositionItem = Me.BindingNavigatorPositionItem
Me.TestBindingNavigator.Size = New System.Drawing.Size(752, 25)
Me.TestBindingNavigator.TabIndex = 1
Me.TestBindingNavigator.Text = "BindingNavigator1"
'
'BindingNavigatorAddNewItem
'
Me.BindingNavigatorAddNewItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
Me.BindingNavigatorAddNewItem.Image = CType(resources.GetObject("BindingNavigatorAddNewItem.Image"), System.Drawing.Image)
Me.BindingNavigatorAddNewItem.Name = "BindingNavigatorAddNewItem"
Me.BindingNavigatorAddNewItem.RightToLeftAutoMirrorImage = True
Me.BindingNavigatorAddNewItem.Size = New System.Drawing.Size(23, 22)
Me.BindingNavigatorAddNewItem.Text = "Add new"
'
'BindingNavigatorCountItem
'
Me.BindingNavigatorCountItem.Name = "BindingNavigatorCountItem"
Me.BindingNavigatorCountItem.Size = New System.Drawing.Size(35, 22)
Me.BindingNavigatorCountItem.Text = "of {0}"
Me.BindingNavigatorCountItem.ToolTipText = "Total number of items"
'
'BindingNavigatorDeleteItem
'
Me.BindingNavigatorDeleteItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
Me.BindingNavigatorDeleteItem.Image = CType(resources.GetObject("BindingNavigatorDeleteItem.Image"), System.Drawing.Image)
Me.BindingNavigatorDeleteItem.Name = "BindingNavigatorDeleteItem"
Me.BindingNavigatorDeleteItem.RightToLeftAutoMirrorImage = True
Me.BindingNavigatorDeleteItem.Size = New System.Drawing.Size(23, 22)
Me.BindingNavigatorDeleteItem.Text = "Delete"
'
'BindingNavigatorMoveFirstItem
'
Me.BindingNavigatorMoveFirstItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
Me.BindingNavigatorMoveFirstItem.Image = CType(resources.GetObject("BindingNavigatorMoveFirstItem.Image"), System.Drawing.Image)
Me.BindingNavigatorMoveFirstItem.Name = "BindingNavigatorMoveFirstItem"
Me.BindingNavigatorMoveFirstItem.RightToLeftAutoMirrorImage = True
Me.BindingNavigatorMoveFirstItem.Size = New System.Drawing.Size(23, 22)
Me.BindingNavigatorMoveFirstItem.Text = "Move first"
'
'BindingNavigatorMovePreviousItem
'
Me.BindingNavigatorMovePreviousItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
Me.BindingNavigatorMovePreviousItem.Image = CType(resources.GetObject("BindingNavigatorMovePreviousItem.Image"), System.Drawing.Image)
Me.BindingNavigatorMovePreviousItem.Name = "BindingNavigatorMovePreviousItem"
Me.BindingNavigatorMovePreviousItem.RightToLeftAutoMirrorImage = True
Me.BindingNavigatorMovePreviousItem.Size = New System.Drawing.Size(23, 22)
Me.BindingNavigatorMovePreviousItem.Text = "Move previous"
'
'BindingNavigatorSeparator
'
Me.BindingNavigatorSeparator.Name = "BindingNavigatorSeparator"
Me.BindingNavigatorSeparator.Size = New System.Drawing.Size(6, 25)
'
'BindingNavigatorPositionItem
'
Me.BindingNavigatorPositionItem.AccessibleName = "Position"
Me.BindingNavigatorPositionItem.AutoSize = False
Me.BindingNavigatorPositionItem.Name = "BindingNavigatorPositionItem"
Me.BindingNavigatorPositionItem.Size = New System.Drawing.Size(50, 23)
Me.BindingNavigatorPositionItem.Text = "0"
Me.BindingNavigatorPositionItem.ToolTipText = "Current position"
'
'BindingNavigatorSeparator1
'
Me.BindingNavigatorSeparator1.Name = "BindingNavigatorSeparator1"
Me.BindingNavigatorSeparator1.Size = New System.Drawing.Size(6, 25)
'
'BindingNavigatorMoveNextItem
'
Me.BindingNavigatorMoveNextItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
Me.BindingNavigatorMoveNextItem.Image = CType(resources.GetObject("BindingNavigatorMoveNextItem.Image"), System.Drawing.Image)
Me.BindingNavigatorMoveNextItem.Name = "BindingNavigatorMoveNextItem"
Me.BindingNavigatorMoveNextItem.RightToLeftAutoMirrorImage = True
Me.BindingNavigatorMoveNextItem.Size = New System.Drawing.Size(23, 22)
Me.BindingNavigatorMoveNextItem.Text = "Move next"
'
'BindingNavigatorMoveLastItem
'
Me.BindingNavigatorMoveLastItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
Me.BindingNavigatorMoveLastItem.Image = CType(resources.GetObject("BindingNavigatorMoveLastItem.Image"), System.Drawing.Image)
Me.BindingNavigatorMoveLastItem.Name = "BindingNavigatorMoveLastItem"
Me.BindingNavigatorMoveLastItem.RightToLeftAutoMirrorImage = True
Me.BindingNavigatorMoveLastItem.Size = New System.Drawing.Size(23, 22)
Me.BindingNavigatorMoveLastItem.Text = "Move last"
'
'BindingNavigatorSeparator2
'
Me.BindingNavigatorSeparator2.Name = "BindingNavigatorSeparator2"
Me.BindingNavigatorSeparator2.Size = New System.Drawing.Size(6, 25)
'
'TestBindingNavigatorSaveItem
'
Me.TestBindingNavigatorSaveItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
Me.TestBindingNavigatorSaveItem.Image = CType(resources.GetObject("TestBindingNavigatorSaveItem.Image"), System.Drawing.Image)
Me.TestBindingNavigatorSaveItem.Name = "TestBindingNavigatorSaveItem"
Me.TestBindingNavigatorSaveItem.Size = New System.Drawing.Size(23, 22)
Me.TestBindingNavigatorSaveItem.Text = "Save Data"
'
'TabControl1
'
Me.TabControl1.Controls.Add(Me.TabPage1)
Me.TabControl1.Controls.Add(Me.TabPage2)
Me.TabControl1.Location = New System.Drawing.Point(63, 70)
Me.TabControl1.Name = "TabControl1"
Me.TabControl1.SelectedIndex = 0
Me.TabControl1.Size = New System.Drawing.Size(468, 247)
Me.TabControl1.TabIndex = 2
'
'TabPage1
'
Me.TabPage1.Controls.Add(Col1Label)
Me.TabPage1.Controls.Add(Me.Col1TextBox)
Me.TabPage1.Controls.Add(IdxLabel)
Me.TabPage1.Controls.Add(Me.IdxTextBox)
Me.TabPage1.Location = New System.Drawing.Point(4, 22)
Me.TabPage1.Name = "TabPage1"
Me.TabPage1.Padding = New System.Windows.Forms.Padding(3)
Me.TabPage1.Size = New System.Drawing.Size(460, 221)
Me.TabPage1.TabIndex = 0
Me.TabPage1.Text = "TabPage1"
Me.TabPage1.UseVisualStyleBackColor = True
'
'TabPage2
'
Me.TabPage2.Controls.Add(Col2Label)
Me.TabPage2.Controls.Add(Me.Col2TextBox)
Me.TabPage2.Location = New System.Drawing.Point(4, 22)
Me.TabPage2.Name = "TabPage2"
Me.TabPage2.Padding = New System.Windows.Forms.Padding(3)
Me.TabPage2.Size = New System.Drawing.Size(460, 221)
Me.TabPage2.TabIndex = 1
Me.TabPage2.Text = "TabPage2"
Me.TabPage2.UseVisualStyleBackColor = True
'
'IdxLabel
'
IdxLabel.AutoSize = True
IdxLabel.Location = New System.Drawing.Point(146, 54)
IdxLabel.Name = "IdxLabel"
IdxLabel.Size = New System.Drawing.Size(23, 13)
IdxLabel.TabIndex = 0
IdxLabel.Text = "idx:"
'
'IdxTextBox
'
Me.IdxTextBox.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.TestBindingSource, "idx", True))
Me.IdxTextBox.Location = New System.Drawing.Point(175, 51)
Me.IdxTextBox.Name = "IdxTextBox"
Me.IdxTextBox.Size = New System.Drawing.Size(100, 20)
Me.IdxTextBox.TabIndex = 1
'
'Col1Label
'
Col1Label.AutoSize = True
Col1Label.Location = New System.Drawing.Point(139, 80)
Col1Label.Name = "Col1Label"
Col1Label.Size = New System.Drawing.Size(30, 13)
Col1Label.TabIndex = 2
Col1Label.Text = "col1:"
'
'Col1TextBox
'
Me.Col1TextBox.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.TestBindingSource, "col1", True))
Me.Col1TextBox.Location = New System.Drawing.Point(175, 77)
Me.Col1TextBox.Name = "Col1TextBox"
Me.Col1TextBox.Size = New System.Drawing.Size(100, 20)
Me.Col1TextBox.TabIndex = 3
'
'Col2Label
'
Col2Label.AutoSize = True
Col2Label.Location = New System.Drawing.Point(141, 101)
Col2Label.Name = "Col2Label"
Col2Label.Size = New System.Drawing.Size(30, 13)
Col2Label.TabIndex = 0
Col2Label.Text = "col2:"
'
'Col2TextBox
'
Me.Col2TextBox.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.TestBindingSource, "col2", True))
Me.Col2TextBox.Location = New System.Drawing.Point(177, 98)
Me.Col2TextBox.Name = "Col2TextBox"
Me.Col2TextBox.Size = New System.Drawing.Size(100, 20)
Me.Col2TextBox.TabIndex = 1
'
'TestBindingSource
'
Me.TestBindingSource.DataMember = "test"
Me.TestBindingSource.DataSource = Me.WPMlocalDataSet
'
'WPMlocalDataSet
'
Me.WPMlocalDataSet.DataSetName = "WPMlocalDataSet"
Me.WPMlocalDataSet.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema
'
'TestTableAdapter
'
Me.TestTableAdapter.ClearBeforeFill = True
'
'TableAdapterManager
'
Me.TableAdapterManager.BackupDataSetBeforeUpdate = False
Me.TableAdapterManager.testTableAdapter = Me.TestTableAdapter
Me.TableAdapterManager.UpdateOrder = TabTestApp.WPMlocalDataSetTableAdapters.TableAdapterManager.UpdateOrderOption.InsertUpdateDelete
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(594, 146)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(100, 20)
Me.TextBox1.TabIndex = 3
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(752, 421)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.TabControl1)
Me.Controls.Add(Me.TestBindingNavigator)
Me.Name = "Form1"
Me.Text = "Form1"
CType(Me.TestBindingNavigator, System.ComponentModel.ISupportInitialize).EndInit()
Me.TestBindingNavigator.ResumeLayout(False)
Me.TestBindingNavigator.PerformLayout()
Me.TabControl1.ResumeLayout(False)
Me.TabPage1.ResumeLayout(False)
Me.TabPage1.PerformLayout()
Me.TabPage2.ResumeLayout(False)
Me.TabPage2.PerformLayout()
CType(Me.TestBindingSource, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.WPMlocalDataSet, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents WPMlocalDataSet As TabTestApp.WPMlocalDataSet
Friend WithEvents TestBindingSource As System.Windows.Forms.BindingSource
Friend WithEvents TestTableAdapter As TabTestApp.WPMlocalDataSetTableAdapters.testTableAdapter
Friend WithEvents TableAdapterManager As TabTestApp.WPMlocalDataSetTableAdapters.TableAdapterManager
Friend WithEvents TestBindingNavigator As System.Windows.Forms.BindingNavigator
Friend WithEvents BindingNavigatorAddNewItem As System.Windows.Forms.ToolStripButton
Friend WithEvents BindingNavigatorCountItem As System.Windows.Forms.ToolStripLabel
Friend WithEvents BindingNavigatorDeleteItem As System.Windows.Forms.ToolStripButton
Friend WithEvents BindingNavigatorMoveFirstItem As System.Windows.Forms.ToolStripButton
Friend WithEvents BindingNavigatorMovePreviousItem As System.Windows.Forms.ToolStripButton
Friend WithEvents BindingNavigatorSeparator As System.Windows.Forms.ToolStripSeparator
Friend WithEvents BindingNavigatorPositionItem As System.Windows.Forms.ToolStripTextBox
Friend WithEvents BindingNavigatorSeparator1 As System.Windows.Forms.ToolStripSeparator
Friend WithEvents BindingNavigatorMoveNextItem As System.Windows.Forms.ToolStripButton
Friend WithEvents BindingNavigatorMoveLastItem As System.Windows.Forms.ToolStripButton
Friend WithEvents BindingNavigatorSeparator2 As System.Windows.Forms.ToolStripSeparator
Friend WithEvents TestBindingNavigatorSaveItem As System.Windows.Forms.ToolStripButton
Friend WithEvents TabControl1 As System.Windows.Forms.TabControl
Friend WithEvents TabPage1 As System.Windows.Forms.TabPage
Friend WithEvents Col1TextBox As System.Windows.Forms.TextBox
Friend WithEvents IdxTextBox As System.Windows.Forms.TextBox
Friend WithEvents TabPage2 As System.Windows.Forms.TabPage
Friend WithEvents Col2TextBox As System.Windows.Forms.TextBox
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
End Class
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:
347:
348:
349:
350:
351:
352:
353:
354:
355:
356:
357:
358:
359:
360:
361:
362:
363:
364:
by: bd9000Posted on 2009-03-12 at 19:21:35ID: 23875669
I made the following change to the code above to get it to work with iterating through the TabPages (I was trying to set the TextBox.Text on the click event of the navigation controls, originally, but the event firing order of the BindingNavigator throws the records out of synch, so the best way, so far, is to use the TextChanged event of the textbox to make it work, instead)
Select allOpen in new window