By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,742 Members | 1,206 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,742 IT Pros & Developers. It's quick & easy.

ErrorProvider With DataSet and Textboxes

P: n/a
I'm having problems using the errorprovider in VB.NET to automatically
display an error icon next to textboxes bound to the same dataset as the
errorprovider.

The sequence of events is :

Build a dataset containing a single table.
Bind the textboxes on a windows form to the datatable.
Bind the errorprovider control to the same datatable.
Use SetColumnError to create an error condition in the datatable.
Navigate to the row containing the error so that its fields are shown in the
bound textboxes.

At thispoint I would expect the error icon to automatically appear next to
the textbox which is bound to the column containing the error - but nothing
appears.

If I bind the same datatable to a datagrid and repeat the same sequence of
events an error icon is displayed in the grid cell.

The help on this subject suggests that any bound control should
automatically activate the error icon when column errors are present on the
current row as you will see if you follow this link :

http://msdn.microsoft.com/library/de...dercontrol.asp

Help on this would be extremely gratefully received while I still have some
hair left !
(I can supply sample code if this would help)
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi,

This is working for me.

Dim strConn As String

Dim strSQL As String

Dim daEmployees As OleDbDataAdapter

Dim conn As OleDbConnection

strConn = "Provider = Microsoft.Jet.OLEDB.4.0;"

strConn &= "Data Source = Northwind.mdb;"

conn = New OleDbConnection(strConn)

daEmployees = New OleDbDataAdapter("Select * From Employees Order by
LastName, FirstName", conn)

daEmployees.Fill(ds, "Employees")

ds.Tables("Employees").Rows(0).SetColumnError("Las tName", "Lazy")

TextBox1.DataBindings.Add("Text", ds.Tables("Employees"), "LastName")

ErrorProvider1.DataSource = ds.Tables("Employees")

Ken

-----------------------

"Lenster" <Le*****@discussions.microsoft.com> wrote in message
news:54**********************************@microsof t.com...
I'm having problems using the errorprovider in VB.NET to automatically
display an error icon next to textboxes bound to the same dataset as the
errorprovider.

The sequence of events is :

Build a dataset containing a single table.
Bind the textboxes on a windows form to the datatable.
Bind the errorprovider control to the same datatable.
Use SetColumnError to create an error condition in the datatable.
Navigate to the row containing the error so that its fields are shown in the
bound textboxes.

At thispoint I would expect the error icon to automatically appear next to
the textbox which is bound to the column containing the error - but nothing
appears.

If I bind the same datatable to a datagrid and repeat the same sequence of
events an error icon is displayed in the grid cell.

The help on this subject suggests that any bound control should
automatically activate the error icon when column errors are present on the
current row as you will see if you follow this link :

http://msdn.microsoft.com/library/de...dercontrol.asp

Help on this would be extremely gratefully received while I still have some
hair left !
(I can supply sample code if this would help)
Nov 21 '05 #2

P: n/a
Thanks for that Ken - I now have automatic error icons, although it has not
been implemented the way the help files suggest it should be done !!

What I have found is that for a dataset containing a table called TEST the
following code DOESN'T work for getting automatic error provider icons
(except in datagrids):
ErrorProvider1.DataSource = mSet
ErrorProvider1.DataMember = "TEST"
also
ErrorProvider1.BindToDataAndErrors(mDataSet, "TEST")
does not work (except in datagrids)

but
ErrorProvider1.DataSource = mSet.Tables("TEST")
DOES work.

Conclusion - I'll stick the the way that works !!
Thanks again for your help.

"Ken Tucker [MVP]" wrote:
Hi,

This is working for me.

Dim strConn As String

Dim strSQL As String

Dim daEmployees As OleDbDataAdapter

Dim conn As OleDbConnection

strConn = "Provider = Microsoft.Jet.OLEDB.4.0;"

strConn &= "Data Source = Northwind.mdb;"

conn = New OleDbConnection(strConn)

daEmployees = New OleDbDataAdapter("Select * From Employees Order by
LastName, FirstName", conn)

daEmployees.Fill(ds, "Employees")

ds.Tables("Employees").Rows(0).SetColumnError("Las tName", "Lazy")

TextBox1.DataBindings.Add("Text", ds.Tables("Employees"), "LastName")

ErrorProvider1.DataSource = ds.Tables("Employees")

Ken

-----------------------

"Lenster" <Le*****@discussions.microsoft.com> wrote in message
news:54**********************************@microsof t.com...
I'm having problems using the errorprovider in VB.NET to automatically
display an error icon next to textboxes bound to the same dataset as the
errorprovider.

The sequence of events is :

Build a dataset containing a single table.
Bind the textboxes on a windows form to the datatable.
Bind the errorprovider control to the same datatable.
Use SetColumnError to create an error condition in the datatable.
Navigate to the row containing the error so that its fields are shown in the
bound textboxes.

At thispoint I would expect the error icon to automatically appear next to
the textbox which is bound to the column containing the error - but nothing
appears.

If I bind the same datatable to a datagrid and repeat the same sequence of
events an error icon is displayed in the grid cell.

The help on this subject suggests that any bound control should
automatically activate the error icon when column errors are present on the
current row as you will see if you follow this link :

http://msdn.microsoft.com/library/de...dercontrol.asp

Help on this would be extremely gratefully received while I still have some
hair left !
(I can supply sample code if this would help)

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.