Jump to content
Xtreme .Net Talk

Recommended Posts

  • *Experts*
Posted

Are you binding the TextBox or manually putting in the value? If you're doing it manually, you can use the .ToString method of the column in your DataSet.

 

If you're binding, you'll have to hook into the DataSet's bind and parse events. Check the help files for info on these two events and how to hook them up so they convert data to/from one type to another.

 

-Nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted

Hi Nerseus

 

I populate the form manually by using dats reader .

 

My code:

If mydataReader.Read() Then

txtDOB.text = myDataReader.Item ("DOB").To string()

txt.....

End if

 

I tried to write as :

txtDOB.text = myDataReader.Item ("DOB").To string("d")

but errors on code.

 

Thank you .

  • *Experts*
Posted

Is the DOB column a DateTime and non-null (System.DBNull.Value)?

 

-Nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
  • *Experts*
Posted

Does the current value contain a null? This might fail on a ToString (can't remember offhand).

 

If it's not null, try casting it as DateTime and then do a ToString, as in:

txtDOB.text = ((DateTime)myDataReader.Item ("DOB")).To string("d");

 

-Nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...