Visual Basic Development Bookmark and Share   
 Home > Visual Basic Interop and Upgrade > Help on populating form a .dat file
 

Help on populating form a .dat file

I know one way of writing to a .dat and one way back. But I am looking for a quicker and more efficient way of doing so.

txtdj_last_name.text = djs.dj_lname
txtdj_first_name.Text = djs.dj_fname
txtdj_house_number.Text = djs.dj_hnum
This is the way I would have done it before but I'm trying to find a quicker way. Not sure if there is one. So far I think that you might be able to from this :
For Each ctl In Me.Controls
    If ctl.ControlType = acTextBox Then
        ctl.value = djs.???
    End If
Next
Where the ??? is I dont know what to put it. djs. is where the files are.

Any idea of a way like this or another way.

I'm a sixth form student doing this btw.
LukeJenx  Friday, November 27, 2009 6:18 PM
We didn't see your data file. Don't know its format. Based on your post, just recommend that you read this code sample for your reference about how to quickly read and write the contents of a text file in VB .NET:
http://www.vb-helper.com/howto_net_read_write_text_file.html
Best regards,
Riquel
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Riquel_Dong  Tuesday, December 01, 2009 5:47 AM
In this scenario just read the data from .DAT file into one array object. Then fetch the required data as needed.
Best regards,
Riquel
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Riquel_Dong  Monday, November 30, 2009 6:18 AM
I have done it now but not using my first way. I finally got it down to just the name from the file. but couldnt get the value.

how could i delete one record from the file. i have managed to get up to making it blank. but cant seen to find a way to remove it from the .dat.
LukeJenx  Monday, November 30, 2009 10:07 AM
We didn't see your data file. Don't know its format. Based on your post, just recommend that you read this code sample for your reference about how to quickly read and write the contents of a text file in VB .NET:
http://www.vb-helper.com/howto_net_read_write_text_file.html
Best regards,
Riquel
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Riquel_Dong  Tuesday, December 01, 2009 5:47 AM

You can use google to search for other answers

Custom Search

More Threads

• Calling other .NET forms from VB6 exposed form
• VB.Net, Excel and multiple workbooks
• Outlook OS Test
• Error when run through Visual Basic 6 Upgrade Assessment Tool
• find font type character size in pdf document using c#.net
• Interop.Excel after uninstalling Office 2007 and installing Office 2003
• Shadow Direct Scod32.dll Hostname not recognized
• High memory usage after upgrade
• Adding Method/Property/Event descriptions to Interop Control and have them appear in VB6
• converted vb 6.0 data environment