Log inUsernamePassword
Log me on automatically each visit    
Register
Register
Log in to check your private messages
Log in to check your private messages
Visual Basic Forum for Visual Basic Programmers VB Forum Index » Database & Reporting

Post new topic   Reply to topic
Database to listbox ?
View previous topic :: View next topic  
Author Message
dark_syde
Newbie


Joined: 04 Feb 2004
Posts: 20
Location: Uk : Hemel Hempstead

PostPosted: Mar 2nd, 2004 06:13 AM    Post subject: Database to listbox ? Reply with quote

Hello everyone. im stuck on a little problem and I have no idea how to work it out.

This is what I would like to do: Confused

I have a form ' frmJobDatabase ' which has a Data1 control which can seacrh through records that are created by the end user.

I have another form ' frmStage ' which has a listbox on it, ' lstRegistration '

What I would like to do is insert whatever is entered in a certain text box ' txtReg ' from the form ' frmJobDatabase ' into the list box ' lstRegistration ' on the form ' frmStage '

How would I go about it ?

Thankyou
Back to top
View user's profile Send private message Send e-mail MSN Messenger
P.T.A.M.
Administrator


Joined: 08 Oct 2003
Posts: 752
Location: Greece

PostPosted: Mar 3rd, 2004 09:19 AM    Post subject: Reply with quote

To enter the value of a textbox in a listbox you can do :

[vb:1:4c9e4f5ca2]ListBox.AddItem TextBox.Text[/vb:1:4c9e4f5ca2]

and just fix the names and specify the forms...

So I guess :

[vb:1:4c9e4f5ca2]frmStage.lstRegistration.AddItem frmJobDatabase.txtReg.Text[/vb:1:4c9e4f5ca2]

However, I don't think that is what you want exactly... Could you explain a little more?

Thanks
_________________
No one is completely useless. They can at least be an example of what to avoid.
Back to top
View user's profile Send private message Send e-mail Visit poster's website ICQ Number
dark_syde
Newbie


Joined: 04 Feb 2004
Posts: 20
Location: Uk : Hemel Hempstead

PostPosted: Mar 3rd, 2004 03:36 PM    Post subject: Reply with quote

That does exactly what I wanted. I guess I shold have mentioned this part in the earlier post but now that I can enter text into the listbox, how can I get it to save all items that are inside the listbox because everytime I close the form they all dissapear.

Thankyou for your reply P.T.A.M
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Avis
Junior Poster


Joined: 07 Oct 2003
Posts: 510
Location: India

PostPosted: Mar 6th, 2004 12:24 PM    Post subject: Reply with quote

Hi dark_syde,

You must be unloading the form. Where as you should just make it disappear if you want to keep the listbox content stay in the listbox. Hiding the form will flush the content of the listbox.

To hide a form you use the following:

[vb:1:ffd6a154bc]Me.Hide[/vb:1:ffd6a154bc]

Hope this helps!

Thanks!
_________________
Code Snippets, Tutorials, Utilities, Controls

Low cost Web Hosting
Hosting starts at as low as $4 per year!


Always follow posting guidelines
Put your VB code in [vb ] your code [ /vb] tags!
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger ICQ Number
P.T.A.M.
Administrator


Joined: 08 Oct 2003
Posts: 752
Location: Greece

PostPosted: Mar 6th, 2004 04:27 PM    Post subject: Reply with quote

You can use the SaveSetting and GetSetting functions to save and get data from the registry Wink Or you can always save to a file and load back. Or an ini file. Are you familiar with these options? If you need any help, just ask Wink
_________________
No one is completely useless. They can at least be an example of what to avoid.
Back to top
View user's profile Send private message Send e-mail Visit poster's website ICQ Number
Display posts from previous:   
Post new topic   Reply to topic    Visual Basic Forum for Visual Basic Programmers VB Forum Index » Database & Reporting All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Visual Basic Forum runs phpBB | Forum Template © iOptional
VB Resources | SSL | Visual Basic