473,750 Members | 2,308 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 6949
Hi,

This is working for me.

Dim strConn As String

Dim strSQL As String

Dim daEmployees As OleDbDataAdapte r

Dim conn As OleDbConnection

strConn = "Provider = Microsoft.Jet.O LEDB.4.0;"

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

conn = New OleDbConnection (strConn)

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

daEmployees.Fil l(ds, "Employees" )

ds.Tables("Empl oyees").Rows(0) .SetColumnError ("LastName", "Lazy")

TextBox1.DataBi ndings.Add("Tex t", ds.Tables("Empl oyees"), "LastName")

ErrorProvider1. DataSource = ds.Tables("Empl oyees")

Ken

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

"Lenster" <Le*****@discus sions.microsoft .com> wrote in message
news:54******** *************** ***********@mic rosoft.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. BindToDataAndEr rors(mDataSet, "TEST")
does not work (except in datagrids)

but
ErrorProvider1. DataSource = mSet.Tables("TE ST")
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 OleDbDataAdapte r

Dim conn As OleDbConnection

strConn = "Provider = Microsoft.Jet.O LEDB.4.0;"

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

conn = New OleDbConnection (strConn)

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

daEmployees.Fil l(ds, "Employees" )

ds.Tables("Empl oyees").Rows(0) .SetColumnError ("LastName", "Lazy")

TextBox1.DataBi ndings.Add("Tex t", ds.Tables("Empl oyees"), "LastName")

ErrorProvider1. DataSource = ds.Tables("Empl oyees")

Ken

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

"Lenster" <Le*****@discus sions.microsoft .com> wrote in message
news:54******** *************** ***********@mic rosoft.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
5542
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. After the data is corrected, the hint does not disappear ! (the exclamation mark however, does disappear). For Microsoft: If I'm correct, and it is a bug, can it be corrected ?
2
4828
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 row selected in the datagrid. I want to save the changes that user make in the textboxes when they select a different row in the datagrid. I tried capturing the textbox.text at datagrid's CurrentCellChanged event but by then the textbox.text...
2
2020
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 using a dataview with no luck. Stored procedure: ALTER Proc spFillSbjRply ( @key int
6
9859
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
2623
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 working with bound data, you set the DataSource propertyof the ErrorProvider to automatically pick error messages up from thedatabase." So, basically I want the ErrorProvider to automatically pick up database errors, but have so far had no...
4
3816
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 seems to me that setting the ToolTip.AutoPopDelay to a large value (e.g., Int32.MaxValue) should acomplish this goal, but it does not. 2. I want to make it so that the ErrorProvider message is always displayed when the mouse is over the...
4
9854
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 it seems like a workaround. I'm not sure if it's the best way: Dim ErrorCounter As Integer Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As
1
1059
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 it seems like a workaround. I'm not sure if it's the best way: Dim ErrorCounter As Integer Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
5
1278
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 form it does not close instead the errorProvider pops up validating for the text(As the textbox is left blank).Is there a property to disbale or to make it inactive? Thank You in advance.
0
8997
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8833
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9568
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
9256
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...
0
6079
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
4881
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3320
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2794
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2218
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.