Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > VBA / Office Integration > Word, PowerPoint, Outlook, and Other Office Products > populating textboxes


Reply
 
Thread Tools Display Modes
  #1  
Old 05-16-2002, 08:07 AM
dmar
Guest
 
Posts: n/a
Question populating textboxes


Hey everyone,
I am in need of help. What I am doing is, I have a form which I am using text boxes to collect data, the data is then being stored on a worksheet. The data is also listed in a listbox. Is there a way to click on a certain entry in the list box and have that information for that entry from the worksheet populate the original textboxes? I am collecting names and addresses and such.
I hope I explained it correctly. I am using VBA / Office 97.
Any help would be greatly appreciated.
Thanx.
Reply With Quote
  #2  
Old 05-16-2002, 04:37 PM
xxxxxq
Guest
 
Posts: n/a
Default

Yes you can.

The easiest way is to alter the program so that each record starts with a unique identifier (i would recommend the row index) then include this as the 1st value in the listbox (or the 1st column). Set the width of the 1st column to 0. When the user selects the clicks the item you can use cells method to read the values. ie:

Code:
private sub ListBox_Click()
  textbox.value = cells(listbox.value,1).formula
end sub
the example above presumes you have used the 1st column as the row number.
Reply With Quote
  #3  
Old 05-17-2002, 08:01 PM
Brendon
Guest
 
Posts: n/a
Default

That's strange, correct me if I am wrong but to assign a value to a textbox, isn't it...
Code:
textbox.text = "Value to the textbox"
Regards
Reply With Quote
  #4  
Old 05-21-2002, 08:46 AM
dmar
Guest
 
Posts: n/a
Default

I got it! Thanks for the help people
Reply With Quote
  #5  
Old 05-21-2002, 11:54 AM
xxxxxq
Guest
 
Posts: n/a
Default

Quote:
Originally posted by Brendon
That's strange, correct me if I am wrong but to assign a value to a textbox, isn't it...
Code:
textbox.text = "Value to the textbox"
Regards
You can assign to value in excel............ but yeah your right
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->