473,854 Members | 1,526 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What does this error message mean?

I have developed a form that would allow the user to load and search a
database several ways, by data range, by specific number or all database
entries. I can successfully load any of the ways once. But when I click a
button labeled "Clear Form" and then attempt to load data again I get the
following error message:

An unhandled exception of type 'System.Argumen tException' occurred in system.
windows.forms.d ll

Additional information: This would cause two bindings in the collection to
bind to the same property.

The data bindings are all to text boxes and one checkbox. It is an MS ACCESS
database I am connecting to.

Imports System.Data
Imports System.Data.Ole Db

Public Class frmDataEntry
Inherits System.Windows. Forms.Form
Windows Form Designer generated Code
Dim dataset1 As New DataSet1
Dim ConnectionStrin g As String = "Provider=Micro soft.Jet.OLEDB. 4.0; Data
Source = C:\AutoCAD Project\AutoCAD _Files.mdb; User ID=Admin"
Dim Connection1 As OleDbConnection = New OleDbConnection (ConnectionStri ng)
Private Sub frmDataEntry_Lo ad(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
lblNavLocation. Text = ""
End Sub
Public Sub btnLoad_Click(B yVal sender As System.Object, ByVal e As System.
EventArgs) Handles btnLoad.Click
Dim Command1 As OleDbCommand = New OleDbCommand("S ELECT * FROM
AutoCAD_Files", Connection1)

Connection1.Ope n()
Command1.Connec tion = Connection1

Dim daAdapter1 As OleDbDataAdapte r = New OleDbDataAdapte r
Dim daAdapter2 As OleDbDataAdapte r = New OleDbDataAdapte r
Dim daAdapter3 As OleDbDataAdapte r = New OleDbDataAdapte r

Dim IDbinding As New Binding("Text", dataset1, "AutoCAD_Files. ID")
Dim FileNamebinding As New Binding("Text", dataset1, "AutoCAD_Fi les.
FILE_NAME")
Dim FileTitlebindin g As New Binding("Text", dataset1, "AutoCAD_Fi les.
FILE_TITLE")
Dim FileDescbinding As New Binding("Text", dataset1, "AutoCAD_Fi les.
FILE_DESCRIPTIO N")
Dim RevLetterbindin g As New Binding("Text", dataset1, "AutoCAD_Fi les.
REV_LETTER")
Dim OrigDatebinding As New Binding("Text", dataset1, "AutoCAD_Fi les.
ORIGINATION_DAT E")
Dim DateModifiedbin ding As New Binding("Text", dataset1,
"AutoCAD_Files. DATE_MODIFIED")

' Check if a drawing number range is selected
If ComboBox1.Selec tedItem <> "" And ComboBox2.Selec tedItem <> "" Then
Dim FromRange As String
Dim ToRange As String
Dim SQLRange As String
FromRange = Trim(UCase(Comb oBox1.SelectedI tem))
ToRange = Trim(UCase(Comb oBox2.SelectedI tem))
SQLRange = "SELECT * FROM AutoCAD_Files WHERE FILE_NAME BETWEEN
""" & FromRange & """ AND """ & ToRange & """"
Dim Command3 As OleDbCommand = New OleDbCommand(SQ LRange,
Connection1)
daAdapter3.Sele ctCommand = Command3
DataGrid1.Visib le = True
daAdapter3.Fill (dataset1, "AutoCAD_Files" )
DataGrid1.SetDa taBinding(datas et1, "AutoCAD_Files" )
editID.DataBind ings.Add(IDbind ing)
editFILE_NAME.D ataBindings.Add (FileNamebindin g)
editFILE_TITLE. DataBindings.Ad d(FileTitlebind ing)
editFILE_DESCRI PTION.DataBindi ngs.Add(FileDes cbinding)
editREV_LETTER. DataBindings.Ad d(RevLetterbind ing)
editORIGINATION _DATE.DataBindi ngs.Add(OrigDat ebinding)
editDATE_MODIFI ED.DataBindings .Add(DateModifi edbinding)
Me.lblNavLocati on.Text = (((Me.BindingCo ntext(dataset1,
"AutoCAD_Files" ).Position + 1).ToString + " of ") _
+ Me.BindingConte xt(dataset1, "AutoCAD_Files" ).Count.
ToString)
Connection1.Clo se()
Exit Sub
End If

' Check if a drawing number is specified
If txtDrawingNum.T ext <> "" Then
Dim SearchString As String
Dim SQL As String
SearchString = Trim(UCase(txtD rawingNum.Text) )
SQL = "SELECT * FROM AutoCAD_Files WHERE FILE_NAME LIKE """ &
SearchString & """"
Dim command2 As OleDbCommand = New OleDbCommand(SQ L, Connection1)
daAdapter2.Sele ctCommand = command2
DataGrid1.Visib le = True
daAdapter2.Fill (dataset1, "AutoCAD_Files" )
DataGrid1.SetDa taBinding(datas et1, "AutoCAD_Files" )
editID.DataBind ings.Add(IDbind ing)
editFILE_NAME.D ataBindings.Add (FileNamebindin g)
editFILE_TITLE. DataBindings.Ad d(FileTitlebind ing)
editFILE_DESCRI PTION.DataBindi ngs.Add(FileDes cbinding)
editREV_LETTER. DataBindings.Ad d(RevLetterbind ing)
editORIGINATION _DATE.DataBindi ngs.Add(OrigDat ebinding)
editDATE_MODIFI ED.DataBindings .Add(DateModifi edbinding)
Me.lblNavLocati on.Text = (((Me.BindingCo ntext(dataset1,
"AutoCAD_Files" ).Position + 1).ToString + " of ") _
+ Me.BindingConte xt(dataset1, "AutoCAD_Files" ).Count.
ToString)
Connection1.Clo se()
Exit Sub
End If

daAdapter1.Sele ctCommand = Command1
DataGrid1.Visib le = True
daAdapter1.Fill (dataset1, "AutoCAD_Files" )
DataGrid1.SetDa taBinding(datas et1, "AutoCAD_Files" )

editID.DataBind ings.Add(IDbind ing)
editFILE_NAME.D ataBindings.Add (FileNamebindin g)
editFILE_TITLE. DataBindings.Ad d(FileTitlebind ing)
editFILE_DESCRI PTION.DataBindi ngs.Add(FileDes cbinding)
editREV_LETTER. DataBindings.Ad d(RevLetterbind ing)
editORIGINATION _DATE.DataBindi ngs.Add(OrigDat ebinding)
editDATE_MODIFI ED.DataBindings .Add(DateModifi edbinding)

Me.lblNavLocati on.Text = (((Me.BindingCo ntext(dataset1,
"AutoCAD_Files" ).Position + 1).ToString + " of ") _
+ Me.BindingConte xt(dataset1, "AutoCAD_Files" ).Count.
ToString)
Connection1.Clo se()
Exit Sub
Private Sub btnClearForm_Cl ick(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnClearForm.Cl ick
dataset1.Clear( )
DataGrid1.Hide( )
lblNavLocation. Text = ""
txtNumber_of_Dr awings.Text = ""
txtDrawingNum.T ext = ""
ComboBox1.Text = ""
ComboBox2.Text = ""
End Sub
--
Message posted via http://www.dotnetmonster.com
Nov 21 '05 #1
3 1896
Hi,

Everytime you press btnload the program binds a bunch of controls to
the data. Next time you press the button it tries to bind the data again
and you get an error. I would call the databindings.cl ear method before I
bind the data.

For example

editFILE_DESCRI PTION.DataBindi ngs.clear
editFILE_DESCRI PTION.DataBindi ngs.Add(FileDes cbinding)
Ken
---------------------
"Frustrated Developer via DotNetMonster.c om" <fo***@DotNetMo nster.com> wrote
in message news:54******** ***@DotNetMonst er.com...
I have developed a form that would allow the user to load and search a
database several ways, by data range, by specific number or all database
entries. I can successfully load any of the ways once. But when I click a
button labeled "Clear Form" and then attempt to load data again I get the
following error message:

An unhandled exception of type 'System.Argumen tException' occurred in
system.
windows.forms.d ll

Additional information: This would cause two bindings in the collection to
bind to the same property.

The data bindings are all to text boxes and one checkbox. It is an MS
ACCESS
database I am connecting to.

Imports System.Data
Imports System.Data.Ole Db

Public Class frmDataEntry
Inherits System.Windows. Forms.Form
Windows Form Designer generated Code
Dim dataset1 As New DataSet1
Dim ConnectionStrin g As String = "Provider=Micro soft.Jet.OLEDB. 4.0;
Data
Source = C:\AutoCAD Project\AutoCAD _Files.mdb; User ID=Admin"
Dim Connection1 As OleDbConnection = New
OleDbConnection (ConnectionStri ng)
Private Sub frmDataEntry_Lo ad(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
lblNavLocation. Text = ""
End Sub
Public Sub btnLoad_Click(B yVal sender As System.Object, ByVal e As
System.
EventArgs) Handles btnLoad.Click
Dim Command1 As OleDbCommand = New OleDbCommand("S ELECT * FROM
AutoCAD_Files", Connection1)

Connection1.Ope n()
Command1.Connec tion = Connection1

Dim daAdapter1 As OleDbDataAdapte r = New OleDbDataAdapte r
Dim daAdapter2 As OleDbDataAdapte r = New OleDbDataAdapte r
Dim daAdapter3 As OleDbDataAdapte r = New OleDbDataAdapte r

Dim IDbinding As New Binding("Text", dataset1, "AutoCAD_Files. ID")
Dim FileNamebinding As New Binding("Text", dataset1,
"AutoCAD_Fi les.
FILE_NAME")
Dim FileTitlebindin g As New Binding("Text", dataset1,
"AutoCAD_Fi les.
FILE_TITLE")
Dim FileDescbinding As New Binding("Text", dataset1,
"AutoCAD_Fi les.
FILE_DESCRIPTIO N")
Dim RevLetterbindin g As New Binding("Text", dataset1,
"AutoCAD_Fi les.
REV_LETTER")
Dim OrigDatebinding As New Binding("Text", dataset1,
"AutoCAD_Fi les.
ORIGINATION_DAT E")
Dim DateModifiedbin ding As New Binding("Text", dataset1,
"AutoCAD_Files. DATE_MODIFIED")

' Check if a drawing number range is selected
If ComboBox1.Selec tedItem <> "" And ComboBox2.Selec tedItem <> ""
Then
Dim FromRange As String
Dim ToRange As String
Dim SQLRange As String
FromRange = Trim(UCase(Comb oBox1.SelectedI tem))
ToRange = Trim(UCase(Comb oBox2.SelectedI tem))
SQLRange = "SELECT * FROM AutoCAD_Files WHERE FILE_NAME BETWEEN
""" & FromRange & """ AND """ & ToRange & """"
Dim Command3 As OleDbCommand = New OleDbCommand(SQ LRange,
Connection1)
daAdapter3.Sele ctCommand = Command3
DataGrid1.Visib le = True
daAdapter3.Fill (dataset1, "AutoCAD_Files" )
DataGrid1.SetDa taBinding(datas et1, "AutoCAD_Files" )
editID.DataBind ings.Add(IDbind ing)
editFILE_NAME.D ataBindings.Add (FileNamebindin g)
editFILE_TITLE. DataBindings.Ad d(FileTitlebind ing)
editFILE_DESCRI PTION.DataBindi ngs.Add(FileDes cbinding)
editREV_LETTER. DataBindings.Ad d(RevLetterbind ing)
editORIGINATION _DATE.DataBindi ngs.Add(OrigDat ebinding)
editDATE_MODIFI ED.DataBindings .Add(DateModifi edbinding)
Me.lblNavLocati on.Text = (((Me.BindingCo ntext(dataset1,
"AutoCAD_Files" ).Position + 1).ToString + " of ") _
+ Me.BindingConte xt(dataset1,
"AutoCAD_Files" ).Count.
ToString)
Connection1.Clo se()
Exit Sub
End If

' Check if a drawing number is specified
If txtDrawingNum.T ext <> "" Then
Dim SearchString As String
Dim SQL As String
SearchString = Trim(UCase(txtD rawingNum.Text) )
SQL = "SELECT * FROM AutoCAD_Files WHERE FILE_NAME LIKE """ &
SearchString & """"
Dim command2 As OleDbCommand = New OleDbCommand(SQ L,
Connection1)
daAdapter2.Sele ctCommand = command2
DataGrid1.Visib le = True
daAdapter2.Fill (dataset1, "AutoCAD_Files" )
DataGrid1.SetDa taBinding(datas et1, "AutoCAD_Files" )
editID.DataBind ings.Add(IDbind ing)
editFILE_NAME.D ataBindings.Add (FileNamebindin g)
editFILE_TITLE. DataBindings.Ad d(FileTitlebind ing)
editFILE_DESCRI PTION.DataBindi ngs.Add(FileDes cbinding)
editREV_LETTER. DataBindings.Ad d(RevLetterbind ing)
editORIGINATION _DATE.DataBindi ngs.Add(OrigDat ebinding)
editDATE_MODIFI ED.DataBindings .Add(DateModifi edbinding)
Me.lblNavLocati on.Text = (((Me.BindingCo ntext(dataset1,
"AutoCAD_Files" ).Position + 1).ToString + " of ") _
+ Me.BindingConte xt(dataset1,
"AutoCAD_Files" ).Count.
ToString)
Connection1.Clo se()
Exit Sub
End If

daAdapter1.Sele ctCommand = Command1
DataGrid1.Visib le = True
daAdapter1.Fill (dataset1, "AutoCAD_Files" )
DataGrid1.SetDa taBinding(datas et1, "AutoCAD_Files" )

editID.DataBind ings.Add(IDbind ing)
editFILE_NAME.D ataBindings.Add (FileNamebindin g)
editFILE_TITLE. DataBindings.Ad d(FileTitlebind ing)
editFILE_DESCRI PTION.DataBindi ngs.Add(FileDes cbinding)
editREV_LETTER. DataBindings.Ad d(RevLetterbind ing)
editORIGINATION _DATE.DataBindi ngs.Add(OrigDat ebinding)
editDATE_MODIFI ED.DataBindings .Add(DateModifi edbinding)

Me.lblNavLocati on.Text = (((Me.BindingCo ntext(dataset1,
"AutoCAD_Files" ).Position + 1).ToString + " of ") _
+ Me.BindingConte xt(dataset1, "AutoCAD_Files" ).Count.
ToString)
Connection1.Clo se()
Exit Sub
Private Sub btnClearForm_Cl ick(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnClearForm.Cl ick
dataset1.Clear( )
DataGrid1.Hide( )
lblNavLocation. Text = ""
txtNumber_of_Dr awings.Text = ""
txtDrawingNum.T ext = ""
ComboBox1.Text = ""
ComboBox2.Text = ""
End Sub
--
Message posted via http://www.dotnetmonster.com

Nov 21 '05 #2
Ken Tucker [MVP] wrote:
Hi,

Everytime you press btnload the program binds a bunch of controls to
the data. Next time you press the button it tries to bind the data again
and you get an error. I would call the databindings.cl ear method before I
bind the data.

For example

editFILE_DESCR IPTION.DataBind ings.clear
editFILE_DESCR IPTION.DataBind ings.Add(FileDe scbinding)

Ken
Thanks for the assistance. I've added the databindings.cl ear() statement to
all of my textbox fields. I'm able to use the combo box selection method
multiple times with no problem However, when I try to type in a specific
drawing number in the txtDrawingNum.t ext field and click btnLoad I get the
same dataset that I previously had from the combo boxes. Any ideas?

Dim dataset1 As New DataSet1
Dim ConnectionStrin g As String = "Provider=Micro soft.Jet.OLEDB. 4.0; Data
Source = C:\AutoCAD Project\AutoCAD _Files.mdb; User ID=Admin"
Dim Connection1 As OleDbConnection = New OleDbConnection (ConnectionStri ng)

Public Sub btnLoad_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnLoad.Click
Dim Command1 As OleDbCommand = New OleDbCommand("S ELECT * FROM
AutoCAD_Files", Connection1)

Connection1.Ope n()
Command1.Connec tion = Connection1

Dim daAdapter1 As OleDbDataAdapte r = New OleDbDataAdapte r
Dim daAdapter2 As OleDbDataAdapte r = New OleDbDataAdapte r
Dim daAdapter3 As OleDbDataAdapte r = New OleDbDataAdapte r

Dim IDbinding As New Binding("Text", dataset1, "AutoCAD_Files. ID")
Dim FileNamebinding As New Binding("Text", dataset1, "AutoCAD_Fi les.
FILE_NAME")
Dim FileTitlebindin g As New Binding("Text", dataset1, "AutoCAD_Fi les.
FILE_TITLE")
Dim FileDescbinding As New Binding("Text", dataset1, "AutoCAD_Fi les.
FILE_DESCRIPTIO N")
Dim RevLetterbindin g As New Binding("Text", dataset1, "AutoCAD_Fi les.
REV_LETTER")
Dim OrigDatebinding As New Binding("Text", dataset1, "AutoCAD_Fi les.
ORIGINATION_DAT E")
Dim DateModifiedbin ding As New Binding("Text", dataset1,
"AutoCAD_Files. DATE_MODIFIED")

' Check if a drawing number range is selected
If ComboBox1.Selec tedItem <> "" And ComboBox2.Selec tedItem <> "" Then
Dim FromRange As String
Dim ToRange As String
Dim SQLRange As String
FromRange = Trim(UCase(Comb oBox1.SelectedI tem))
ToRange = Trim(UCase(Comb oBox2.SelectedI tem))
SQLRange = "SELECT * FROM AutoCAD_Files WHERE FILE_NAME BETWEEN
""" & FromRange & """ AND """ & ToRange & """"
Dim Command3 As OleDbCommand = New OleDbCommand(SQ LRange,
Connection1)
daAdapter3.Sele ctCommand = Command3
DataGrid1.Visib le = True
daAdapter3.Fill (dataset1, "AutoCAD_Files" )
DataGrid1.SetDa taBinding(datas et1, "AutoCAD_Files" )
editID.DataBind ings.Clear()
editID.DataBind ings.Add(IDbind ing)
editFILE_NAME.D ataBindings.Cle ar()
editFILE_NAME.D ataBindings.Add (FileNamebindin g)
editFILE_TITLE. DataBindings.Cl ear()
editFILE_TITLE. DataBindings.Ad d(FileTitlebind ing)
editFILE_DESCRI PTION.DataBindi ngs.Clear()
editFILE_DESCRI PTION.DataBindi ngs.Add(FileDes cbinding)
editREV_LETTER. DataBindings.Cl ear()
editREV_LETTER. DataBindings.Ad d(RevLetterbind ing)
editORIGINATION _DATE.DataBindi ngs.Clear()
editORIGINATION _DATE.DataBindi ngs.Add(OrigDat ebinding)
editDATE_MODIFI ED.DataBindings .Clear()
editDATE_MODIFI ED.DataBindings .Add(DateModifi edbinding)
Me.lblNavLocati on.Text = (((Me.BindingCo ntext(dataset1,
"AutoCAD_Files" ).Position + 1).ToString + " of ") _
+ Me.BindingConte xt(dataset1, "AutoCAD_Files" ).Count.
ToString)
Connection1.Clo se()
Exit Sub
End If

' Check if a drawing number is specified
If txtDrawingNum.T ext <> "" Then
Dim SearchString As String
Dim SQL As String
SearchString = Trim(UCase(txtD rawingNum.Text) )
SQL = "SELECT * FROM AutoCAD_Files WHERE FILE_NAME LIKE """ &
SearchString & """"
Dim command2 As OleDbCommand = New OleDbCommand(SQ L, Connection1)
daAdapter2.Sele ctCommand = command2
DataGrid1.Visib le = True
daAdapter2.Fill (dataset1, "AutoCAD_Files" )
DataGrid1.SetDa taBinding(datas et1, "AutoCAD_Files" )
editID.DataBind ings.Clear()
editID.DataBind ings.Add(IDbind ing)
editFILE_NAME.D ataBindings.Cle ar()
editFILE_NAME.D ataBindings.Add (FileNamebindin g)
editFILE_TITLE. DataBindings.Cl ear()
editFILE_TITLE. DataBindings.Ad d(FileTitlebind ing)
editFILE_DESCRI PTION.DataBindi ngs.Clear()
editFILE_DESCRI PTION.DataBindi ngs.Add(FileDes cbinding)
editREV_LETTER. DataBindings.Cl ear()
editREV_LETTER. DataBindings.Ad d(RevLetterbind ing)
editORIGINATION _DATE.DataBindi ngs.Clear()
editORIGINATION _DATE.DataBindi ngs.Add(OrigDat ebinding)
editDATE_MODIFI ED.DataBindings .Clear()
editDATE_MODIFI ED.DataBindings .Add(DateModifi edbinding)
Me.lblNavLocati on.Text = (((Me.BindingCo ntext(dataset1,
"AutoCAD_Files" ).Position + 1).ToString + " of ") _
+ Me.BindingConte xt(dataset1, "AutoCAD_Files" ).Count.
ToString)
Connection1.Clo se()
Exit Sub
End If

daAdapter1.Sele ctCommand = Command1
DataGrid1.Visib le = True
daAdapter1.Fill (dataset1, "AutoCAD_Files" )
DataGrid1.SetDa taBinding(datas et1, "AutoCAD_Files" )

editID.DataBind ings.Clear()
editID.DataBind ings.Add(IDbind ing)
editFILE_NAME.D ataBindings.Cle ar()
editFILE_NAME.D ataBindings.Add (FileNamebindin g)
editFILE_TITLE. DataBindings.Cl ear()
editFILE_TITLE. DataBindings.Ad d(FileTitlebind ing)
editFILE_DESCRI PTION.DataBindi ngs.Clear()
editFILE_DESCRI PTION.DataBindi ngs.Add(FileDes cbinding)
editREV_LETTER. DataBindings.Cl ear()
editREV_LETTER. DataBindings.Ad d(RevLetterbind ing)
editORIGINATION _DATE.DataBindi ngs.Clear()
editORIGINATION _DATE.DataBindi ngs.Add(OrigDat ebinding)
editDATE_MODIFI ED.DataBindings .Clear()
editDATE_MODIFI ED.DataBindings .Add(DateModifi edbinding)

Me.lblNavLocati on.Text = (((Me.BindingCo ntext(dataset1,
"AutoCAD_Files" ).Position + 1).ToString + " of ") _
+ Me.BindingConte xt(dataset1, "AutoCAD_Files" ).Count.
ToString)
Connection1.Clo se()
Exit Sub
End Sub---------------------
I have developed a form that would allow the user to load and search a
database several ways, by data range, by specific number or all database

[quoted text clipped - 152 lines]
ComboBox2.Text = ""
End Sub

--
Message posted via http://www.dotnetmonster.com
Nov 21 '05 #3
Hi,

I would add another textbox for searching. Here is an example
on finding records

http://www.windowsformsdatagridhelp....7-26a58190eb5c

Ken
---------------------
"Frustrated Developer via DotNetMonster.c om" <fo***@DotNetMo nster.com> wrote
in message news:54******** ***@DotNetMonst er.com...
Ken Tucker [MVP] wrote:
Hi,

Everytime you press btnload the program binds a bunch of controls
to
the data. Next time you press the button it tries to bind the data again
and you get an error. I would call the databindings.cl ear method before I
bind the data.

For example

editFILE_DESC RIPTION.DataBin dings.clear
editFILE_DESC RIPTION.DataBin dings.Add(FileD escbinding)

Ken


Thanks for the assistance. I've added the databindings.cl ear() statement
to
all of my textbox fields. I'm able to use the combo box selection method
multiple times with no problem However, when I try to type in a specific
drawing number in the txtDrawingNum.t ext field and click btnLoad I get the
same dataset that I previously had from the combo boxes. Any ideas?

Dim dataset1 As New DataSet1
Dim ConnectionStrin g As String = "Provider=Micro soft.Jet.OLEDB. 4.0; Data
Source = C:\AutoCAD Project\AutoCAD _Files.mdb; User ID=Admin"
Dim Connection1 As OleDbConnection = New OleDbConnection (ConnectionStri ng)

Public Sub btnLoad_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnLoad.Click
Dim Command1 As OleDbCommand = New OleDbCommand("S ELECT * FROM
AutoCAD_Files", Connection1)

Connection1.Ope n()
Command1.Connec tion = Connection1

Dim daAdapter1 As OleDbDataAdapte r = New OleDbDataAdapte r
Dim daAdapter2 As OleDbDataAdapte r = New OleDbDataAdapte r
Dim daAdapter3 As OleDbDataAdapte r = New OleDbDataAdapte r

Dim IDbinding As New Binding("Text", dataset1, "AutoCAD_Files. ID")
Dim FileNamebinding As New Binding("Text", dataset1,
"AutoCAD_Fi les.
FILE_NAME")
Dim FileTitlebindin g As New Binding("Text", dataset1,
"AutoCAD_Fi les.
FILE_TITLE")
Dim FileDescbinding As New Binding("Text", dataset1,
"AutoCAD_Fi les.
FILE_DESCRIPTIO N")
Dim RevLetterbindin g As New Binding("Text", dataset1,
"AutoCAD_Fi les.
REV_LETTER")
Dim OrigDatebinding As New Binding("Text", dataset1,
"AutoCAD_Fi les.
ORIGINATION_DAT E")
Dim DateModifiedbin ding As New Binding("Text", dataset1,
"AutoCAD_Files. DATE_MODIFIED")

' Check if a drawing number range is selected
If ComboBox1.Selec tedItem <> "" And ComboBox2.Selec tedItem <> ""
Then
Dim FromRange As String
Dim ToRange As String
Dim SQLRange As String
FromRange = Trim(UCase(Comb oBox1.SelectedI tem))
ToRange = Trim(UCase(Comb oBox2.SelectedI tem))
SQLRange = "SELECT * FROM AutoCAD_Files WHERE FILE_NAME BETWEEN
""" & FromRange & """ AND """ & ToRange & """"
Dim Command3 As OleDbCommand = New OleDbCommand(SQ LRange,
Connection1)
daAdapter3.Sele ctCommand = Command3
DataGrid1.Visib le = True
daAdapter3.Fill (dataset1, "AutoCAD_Files" )
DataGrid1.SetDa taBinding(datas et1, "AutoCAD_Files" )
editID.DataBind ings.Clear()
editID.DataBind ings.Add(IDbind ing)
editFILE_NAME.D ataBindings.Cle ar()
editFILE_NAME.D ataBindings.Add (FileNamebindin g)
editFILE_TITLE. DataBindings.Cl ear()
editFILE_TITLE. DataBindings.Ad d(FileTitlebind ing)
editFILE_DESCRI PTION.DataBindi ngs.Clear()
editFILE_DESCRI PTION.DataBindi ngs.Add(FileDes cbinding)
editREV_LETTER. DataBindings.Cl ear()
editREV_LETTER. DataBindings.Ad d(RevLetterbind ing)
editORIGINATION _DATE.DataBindi ngs.Clear()
editORIGINATION _DATE.DataBindi ngs.Add(OrigDat ebinding)
editDATE_MODIFI ED.DataBindings .Clear()
editDATE_MODIFI ED.DataBindings .Add(DateModifi edbinding)
Me.lblNavLocati on.Text = (((Me.BindingCo ntext(dataset1,
"AutoCAD_Files" ).Position + 1).ToString + " of ") _
+ Me.BindingConte xt(dataset1,
"AutoCAD_Files" ).Count.
ToString)
Connection1.Clo se()
Exit Sub
End If

' Check if a drawing number is specified
If txtDrawingNum.T ext <> "" Then
Dim SearchString As String
Dim SQL As String
SearchString = Trim(UCase(txtD rawingNum.Text) )
SQL = "SELECT * FROM AutoCAD_Files WHERE FILE_NAME LIKE """ &
SearchString & """"
Dim command2 As OleDbCommand = New OleDbCommand(SQ L,
Connection1)
daAdapter2.Sele ctCommand = command2
DataGrid1.Visib le = True
daAdapter2.Fill (dataset1, "AutoCAD_Files" )
DataGrid1.SetDa taBinding(datas et1, "AutoCAD_Files" )
editID.DataBind ings.Clear()
editID.DataBind ings.Add(IDbind ing)
editFILE_NAME.D ataBindings.Cle ar()
editFILE_NAME.D ataBindings.Add (FileNamebindin g)
editFILE_TITLE. DataBindings.Cl ear()
editFILE_TITLE. DataBindings.Ad d(FileTitlebind ing)
editFILE_DESCRI PTION.DataBindi ngs.Clear()
editFILE_DESCRI PTION.DataBindi ngs.Add(FileDes cbinding)
editREV_LETTER. DataBindings.Cl ear()
editREV_LETTER. DataBindings.Ad d(RevLetterbind ing)
editORIGINATION _DATE.DataBindi ngs.Clear()
editORIGINATION _DATE.DataBindi ngs.Add(OrigDat ebinding)
editDATE_MODIFI ED.DataBindings .Clear()
editDATE_MODIFI ED.DataBindings .Add(DateModifi edbinding)
Me.lblNavLocati on.Text = (((Me.BindingCo ntext(dataset1,
"AutoCAD_Files" ).Position + 1).ToString + " of ") _
+ Me.BindingConte xt(dataset1,
"AutoCAD_Files" ).Count.
ToString)
Connection1.Clo se()
Exit Sub
End If

daAdapter1.Sele ctCommand = Command1
DataGrid1.Visib le = True
daAdapter1.Fill (dataset1, "AutoCAD_Files" )
DataGrid1.SetDa taBinding(datas et1, "AutoCAD_Files" )

editID.DataBind ings.Clear()
editID.DataBind ings.Add(IDbind ing)
editFILE_NAME.D ataBindings.Cle ar()
editFILE_NAME.D ataBindings.Add (FileNamebindin g)
editFILE_TITLE. DataBindings.Cl ear()
editFILE_TITLE. DataBindings.Ad d(FileTitlebind ing)
editFILE_DESCRI PTION.DataBindi ngs.Clear()
editFILE_DESCRI PTION.DataBindi ngs.Add(FileDes cbinding)
editREV_LETTER. DataBindings.Cl ear()
editREV_LETTER. DataBindings.Ad d(RevLetterbind ing)
editORIGINATION _DATE.DataBindi ngs.Clear()
editORIGINATION _DATE.DataBindi ngs.Add(OrigDat ebinding)
editDATE_MODIFI ED.DataBindings .Clear()
editDATE_MODIFI ED.DataBindings .Add(DateModifi edbinding)

Me.lblNavLocati on.Text = (((Me.BindingCo ntext(dataset1,
"AutoCAD_Files" ).Position + 1).ToString + " of ") _
+ Me.BindingConte xt(dataset1, "AutoCAD_Files" ).Count.
ToString)
Connection1.Clo se()
Exit Sub
End Sub
---------------------
I have developed a form that would allow the user to load and search a
database several ways, by data range, by specific number or all database

[quoted text clipped - 152 lines]
ComboBox2.Text = ""
End Sub

--
Message posted via http://www.dotnetmonster.com

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
6933
by: lkrubner | last post by:
I want to give users the power to edit files from an easy interface, so I create a form and a PHP script called "fileUpdate". It does a reasonable about of error checking and prints out some errors. It uses fileperms() to get the permissions of the file, and it includes that info in any error message. Today I'm getting the following error message. I've used SmartFtp to go in and set the test file's permissions to 777, but in this error...
72
5922
by: E. Robert Tisdale | last post by:
What makes a good C/C++ programmer? Would you be surprised if I told you that it has almost nothing to do with your knowledge of C or C++? There isn't much difference in productivity, for example, between a C/C++ programmers with a few weeks of experience and a C/C++ programmer with years of experience. You don't really need to understand the subtle details or use the obscure features of either language
6
23681
by: WindAndWaves | last post by:
Hi Folks I have inhereted a script that I understand reasonably well, I just do not understand !/^\d+$/.test(el.value) what the hell does that mean? Below is the script (there are really three and they validate a four items
121
10246
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode support IDEs are DreamWeaver 8 and Zend PHP Studio. DreamWeaver provides full support for Unicode. However, DreamWeaver is a web editor rather than a PHP IDE. It only supports basic IntelliSense (or code completion) and doesn't have anything...
13
5069
by: Jason Huang | last post by:
Hi, Would someone explain the following coding more detail for me? What's the ( ) for? CurrentText = (TextBox)e.Item.Cells.Controls; Thanks. Jason
8
11445
by: kevin | last post by:
I have a form and in the form I have a sub that uses a class I instantiate using visual basic code: Public oCP As New Rs232 'instantiate the comm port I need to share this sub with another form so to declare the sub I use visual basic code: Public Shared Function IsPortAvailable(ByVal ComPort As Integer) As Boolean
669
26376
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic paper written on this subject. On the Expressive Power of Programming Languages, by Matthias Felleisen, 1990. http://www.ccs.neu.edu/home/cobbe/pl-seminar-jr/notes/2003-sep-26/expressive-slides.pdf
13
520
by: Protoman | last post by:
I'm getting an error: 10 C:\Dev-Cpp\Enigma.cpp no match for 'operator<' in 'i < (+cleartext)->std::basic_string<_CharT, _Traits, _Alloc>::end ()' Code: Enigma.hpp -------------------------- #pragma once
6
2438
by: Bint | last post by:
I'm getting this returned from a PHP script. What does this mean? <b>Parse error</b>: syntax error, unexpected ')', expecting T_PAAMAYIM_NEKUDOTAYIM in <b>/ho Thanks B
5
13507
by: =?GB2312?B?17/HvyBaaHVvLCBRaWFuZw==?= | last post by:
Hi, I would like to have someone comments on what's the best practice defining error codes in C. Here's what I think: solution A: using enum pros: type safe. better for debug (some debugger will show the name not only the value) cons: enum can not be forward declared which makes all error codes
0
11024
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10675
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10749
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10367
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7912
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7079
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5939
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4152
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.