473,387 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

ErrorProvider With DataSet and Textboxes

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
2 6913
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Martijn Leine | last post by:
I am using an errorprovider and a datagrid component on a form. I use the errorprovider to display error hints in the grid, in the case the entered data by the user is checked and not found Ok....
2
by: Alpha | last post by:
Hi, I have a window based program. One of the form has several textboxes and a datagrid. The textboxes are bind to the same dataset table as the datagrid and the text changes to reflect different...
2
by: Sandy | last post by:
Hello - I have the following stored procedure and code. I want to put the results in two textboxes. I get to the part where I create the dataset and then I don't know what to do. I tried...
6
by: M O J O | last post by:
Hi, How do I check if an ErrorProvider has errors? Take for example this code... (err = ErrorProvider...) Public Sub Test If TextBox1.Text= "" Then
3
by: Jeppe Jespersen | last post by:
I read the following - regarding the ErrorProvider control - in the MOC Course Material for course 2373: "You can set your own error messages manually, as shown in the following example, or when...
4
by: ljlevend | last post by:
I have the following issues: 1. I want to make it so that ToolTips never go away once they are shown until the user moves the mouse outside of the control for which the ToolTip is assigned. It...
4
by: johnb41 | last post by:
I have a form with a bunch of textboxes. Each text box gets validated with the ErrorProvider. I want the form to process something ONLY when all the textboxes are valid. I found a solution,...
1
by: johnb41 | last post by:
I have a form with a bunch of textboxes. Each text box gets validated with the ErrorProvider. I want the form to process something ONLY when ALL the textboxes are valid. I found a solution, but...
5
by: artteam | last post by:
Hi All, I have used errorProvider to validate the text in the textboxes. One among them is that it does not allow the user to enter empty string.But when I click the close button on the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...

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.