vb.net databind combo
Box never lost focus?
I set up a connection to a table books of a database.
================================
table fields
ISBN,
title,
cost
=======================================
I changed the ISBN number to a combo
Box and dragged and dropped down the whole table in details view to the form
================================
isbn: --------|
------- ^
^
title xxxxxxx
cost xxxxxxxxx
===============================
I deleted the navigation bar at the top.
I clicked on the smart tag and selected the data bind item check
Box. then I configured the datasource,display member and selected value.
Different books can be seen by selecting different isbn from the combo
Box.
However,I can not move my mouse to the cost textfield or title textfield on the form. Even worse,I can not close the form.
This is so wired.
Can anyone tell me why and how to solve this problem? I will give u the credits immediatelly if ur answer is valid.
__________________________________________________________________________
''Please see the code below
Public Class DetailsForm
Private Sub bindingNavigatorSaveItem_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)
If Me.Validate Then
Me.BooksBindingSource.EndEdit()
Me.BooksTableAdapter.Update(Me.RnrBooksDataSet.Books)
Else
System.Windows.Forms.Message
Box.Show(Me,"Validation errors occurred. ","Save ",System.Windows.Forms.Message
BoxButtons.OK,System.Windows.Forms.Message
BoxIcon.Warning)
End If
End Sub
Private Sub DetailsForm_Load(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles MyBase.Load
''TODO: This line of code loads data into the ''RnrBooksDataSet.Books '' table. You can move,or remove it,as needed.
Me.BooksTableAdapter.Fill(Me.RnrBooksDataSet.Books)
End Sub
End Class
_
Partial Public Class DetailsForm
Inherits System.Windows.Forms.Form
''Form overrides dispose to clean up the component list.
_
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
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.
_ Private Sub InitializeComponent() '' ''Subject_CodeLabel '' Subject_CodeLabel.AutoSize = True Subject_CodeLabel.Location = New System.Drawing.Point(28,148) Subject_CodeLabel.Name = "Subject_CodeLabel " Subject_CodeLabel.Size = New System.Drawing.Size(83,12) Subject_CodeLabel.TabIndex = 9 Subject_CodeLabel.Text = "Subject Code: " '' ''Shelf_LocationLabel '' Shelf_LocationLabel.AutoSize = True Shelf_LocationLabel.Location = New System.Drawing.Point(28,173) Shelf_LocationLabel.Name = "Shelf_LocationLabel " Shelf_LocationLabel.Size = New System.Drawing.Size(95,12) Shelf_LocationLabel.TabIndex = 11 Shelf_LocationLabel.Text = "Shelf Location: " '' ''RnrBooksDataSet '' Me.RnrBooksDataSet.DataSetName = "RnrBooksDataSet " '' ''BooksBindingSource '' Me.BooksBindingSource.DataMember = "Books " Me.BooksBindingSource.DataSource = Me.RnrBooksDataSet '' ''BooksTableAdapter '' Me.BooksTableAdapter.ClearBeforeFill = True '' ''TitleTextBox '' Me.TitleTextBox.DataBindings.Add(New System.Windows.Forms.Binding( "Text ",Me.BooksBindingSource,"Title ",True)) Me.TitleTextBox.Location = New System.Drawing.Point(109,70) Me.TitleTextBox.Name = "TitleTextBox " Me.TitleTextBox.Size = New System.Drawing.Size(303,21) Me.TitleTextBox.TabIndex = 4 '' ''AuthorTextBox '' Me.AuthorTextBox.DataBindings.Add(New System.Windows.Forms.Binding( "Text ","Author ",True)) Me.AuthorTextBox.Location = New System.Drawing.Point(109,95) Me.AuthorTextBox.Name = "AuthorTextBox " Me.AuthorTextBox.Size = New System.Drawing.Size(303,21) Me.AuthorTextBox.TabIndex = 6 '' ''PublisherTextBox '' Me.PublisherTextBox.DataBindings.Add(New System.Windows.Forms.Binding( "Text ","Publisher ",True)) Me.PublisherTextBox.Location = New System.Drawing.Point(109,120) Me.PublisherTextBox.Name = "PublisherTextBox " Me.PublisherTextBox.Size = New System.Drawing.Size(303,21) Me.PublisherTextBox.TabIndex = 8 '' ''Subject_CodeTextBox '' Me.Subject_CodeTextBox.DataBindings.Add(New System.Windows.Forms.Binding( "Text ","Subject_Code ",True)) Me.Subject_CodeTextBox.Location = New System.Drawing.Point(109,145) Me.Subject_CodeTextBox.Name = "Subject_CodeTextBox " Me.Subject_CodeTextBox.Size = New System.Drawing.Size(303,21) Me.Subject_CodeTextBox.TabIndex = 10 '' ''Shelf_LocationTextBox '' Me.Shelf_LocationTextBox.DataBindings.Add(New System.Windows.Forms.Binding( "Text ","Shelf_Location ",True)) Me.Shelf_LocationTextBox.Location = New System.Drawing.Point(109,170) Me.Shelf_LocationTextBox.Name = "Shelf_LocationTextBox " Me.Shelf_LocationTextBox.Size = New System.Drawing.Size(303,21) Me.Shelf_LocationTextBox.TabIndex = 12 '' ''FictionCheckBox '' Me.FictionCheckBox.DataBindings.Add(New System.Windows.Forms.Binding( "CheckState ","Fiction ",True)) Me.FictionCheckBox.Location = New System.Drawing.Point(109,195) Me.FictionCheckBox.Name = "FictionCheckBox " Me.FictionCheckBox.Size = New System.Drawing.Size(104,22) Me.FictionCheckBox.TabIndex = 14 '' ''ISBNComboBox '' Me.ISBNComboBox.DataBindings.Add(New System.Windows.Forms.Binding( "Text ","ISBN ",True)) Me.ISBNComboBox.DataSource = Me.BooksBindingSource Me.ISBNComboBox.DisplayMember = "ISBN " Me.ISBNComboBox.FormattingEnabled = True Me.ISBNComboBox.Location = New System.Drawing.Point(109,45) Me.ISBNComboBox.Name = "ISBNComboBox " Me.ISBNComboBox.Size = New System.Drawing.Size(303,20) Me.ISBNComboBox.TabIndex = 2 Me.ISBNComboBox.ValueMember = "ISBN " '' ''TextBox1 '' Me.TextBox1.Location = New System.Drawing.Point(157,211) Me.TextBox1.Name = "TextBox1 " Me.TextBox1.Size = New System.Drawing.Size(199,21) Me.TextBox1.TabIndex = 15 '' . . End Class __________________________________________________________________________
原文链接:https://www.f2er.com/vb/263777.html