timed Posted February 18, 2003 Posted February 18, 2003 Databinding to a maskedit control I am having trouble tring to databind information from a dataset that is created and enter it in a maskedit box. When I bind the information to the textboxes evreything is fine it is when i get to the maskedit boxes is where I get the error, any sugestions. Thanks in Advance. I am a beginer to .net The error that I am reciving is a An unhandled exception of type 'System.ArgumentException' occurred in system.windows.forms.dll Additional information: Cannot bind to property or column Phone2 on DataSource. Here is the code 'Lets bind the data from the DataSet txtId.DataBindings.Add("Text", dsClients.Tables(0), "iClientID" & "") txtAddress.DataBindings.Add("Text", dsClients.Tables(0), "cAddress") txtMiddle.DataBindings.Add("Text", dsClients.Tables(0), "cMiddleName") txtCity.DataBindings.Add("Text", dsClients.Tables(0), "cCity") txtState.DataBindings.Add("Text", dsClients.Tables(0), "cState") txtZip.DataBindings.Add("Text", dsClients.Tables(0), "cZip") mskPhone.DataBindings.Add("MaskText", dsClients.Tables(0), "cPhone") mskPhone2.DataBindings.Add("Text", dsClients.Tables(0), "Phone2") mskSSN.DataBindings.Add("Text", dsClients.Tables(0), "cSSN") txtNotes.DataBindings.Add("Text", dsClients.Tables(0), "cNotes") Quote
Cywizz Posted February 18, 2003 Posted February 18, 2003 Your error is pointing to the mskPhone2's databinding, but I see a problem with your mskPhone' databinding statement. You are trying to bind to a 'MaskText' property, and I think you meant to bind to the 'Mask' property? Quote Howzit??
timed Posted February 18, 2003 Author Posted February 18, 2003 Thanks so much, that did the trick. Quote
*Experts* Volte Posted February 18, 2003 *Experts* Posted February 18, 2003 I feel I must point out that you shouldn't be using the MaskEditBox from VB6 in VB.NET; I think the most popular way of doing text-box validation is to use the 'Validating' event, along with the ErrorProvider component. Here is a tutorial on that. Quote
timed Posted February 18, 2003 Author Posted February 18, 2003 Thank you, I will take a look into this. I know it is not good to use a maskedit control, but I was in a crunch for time. I am going to take a look at this and start using text validation. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.