Databinding textbox argument exception

  • Thread starter Thread starter daniel.irwin
  • Start date Start date
D

daniel.irwin

Hi All,

Getting a problem when trying to bind data to a textbox in a smart
device application using visual studio 2003, CF 1.0 and win ce 4.2.
Below is the code:

strSQL = "SELECT * FROM Visit WHERE SiteID= '"
& strSiteName & "' AND D_Date = '" & strDate & "' AND UserID = '" &
strUserName & "'"
cmd.CommandText = strSQL

da = New SqlCeDataAdapter(cmd)
ds = New DataSet
da.Fill(ds, "SiteVisit")
txtSourceID.DataBindings.Add("Text",
ds.Tables("SiteVisit"), "SourceID")

When trying to bind I get an argument exception error with null
reference? This same code works fine in my test windows application,
so what could the problem be? I even know that the data is there as
databinding to a datagrid works fine, it's just textboxes that seem to
be a problem. Any ideas would be appreciated!

Cheers

Dan
 
Probably you don't have a table called "SiteVisit" in the DataSet or there's
no column called "SourceID" in it.



I'm also confused by "I get an argument exception error with null
reference". Are you getting ArgumentException or are you getting
NullRefereceException?


--
Best regards,


Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
 
Hi Ilya,

Thanks for the response. Thankfully I've found the problem and it
actually had nothing to do with the databinding, the problem lay in a
splash screen thread which was casuing the debugger to 'jump'!
Unbelievable that I've spent this long looking at a problem that didn't
exist!!

Thanks again anyway.

Dan
 
Hi Ilya,

Thanks for the response. Thankfully I've found the problem and it
actually had nothing to do with the databinding, the problem lay in a
splash screen thread which was casuing the debugger to 'jump'!
Unbelievable that I've spent this long looking at a problem that didn't
exist!!

Thanks again anyway.

Dan
 
Back
Top