Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Activation of List box within a Form

Status
Not open for further replies.

TerryUrb

Programmer
Oct 3, 2005
40
CA
I am having a problem displaying a list of items. When I run the form, the list appears to be not activated and the list is not displayed.
Here is the code I have put into AddItem,AddListItem and AddProperty

frmForm1.lstMyListBox.RowSourceType = 1
frmForm1.lstMyListBox.RowSource = "67,100.0,103.7,253.5"

I am new to this object and need some help ... thanks
 
Try:
Code:
frmForm1.lstMyListBox.RowSourceType = 1
frmForm1.lstMyListBox.RowSource     = "67,100.0,103.7,253.5"
frmForm1.lstMyListBox.ListIndex     = 1
frmForm1.lstMyListBox.SetFocus()

Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.
 
I tried your suggestions, but the List Box is empty. I have it set to display 3 line items. Is the List Box activated with AddItem, AddListTiem and AddProperty or is it activated in another manner? Maybe I should ask, where do I insert this code?
 
This code works for me. What version of VFP you use?

Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.
 
Hi Borissov,
I am using VFP9.0 SP1.
Where do I put the code so when it creates the object it reads and displays it? The list box is blank. Maybe that is what is wrong. I have inserted your code into AddItem in the Properties/Methods.


 
No I put this in Init Event of the form.
You could use AddItem only when you Add an Item to List box, like:
<pre>
thisform.ListBox.AddItem([Some item])
thisform.ListBox.AddItem([Second item])
</pre>
But put your code (and my addition) in Init event of the form and all will be OK.

Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.
 
I put the code in the init but it says that the 'object' is not correct, in my case I used TxCtcssTone for the name instead of List1, generated when I created the list. I think maybe my syntax in not correct.

I used TxCtcssTone.RowSourceType = 1

 
Thanks Borislav and Mike for your help. When I changed the syntax, it worked fine. Where do I find the correct syntax for the objects? Or is that too stupid of a question?
 
Terry,
Well, if you have Intellisense enabled (ie the default), it will pop up for you as you type the command in, and show you what parameters are taken, and where they fall... For commands it will pop up with automatic list boxes to pick the next key word from...

(Or, as BB mentioned, The Help File...)


Best Regards,
Scott

&quot;Everything should be made as simple as possible, and no simpler.&quot;[hammer]
 
Thank you very much for your help. All of you. It has been a great help. I have been doing lots of reading, in fact I have three books on VFP. There is a learning curve and you guys are helping me out tremendously. Thanks Again!
 
Terry,
If you are a newbie, one of the things the helped me cross the VFP gap 4 years ago was a CD training course (not an endorsement, just an experience) that came from AppDev. The video work included on the CDs was excellent, especially in understanding the OOP aspects, and how this style of "Read Events" works. I would not be doing VFP dev today were it not for them. I don't think they have updated them in a long time, sadly, but the VFP6 CDs are still a good 90% or better relevant. Maybe you can get them cheap from them???



Best Regards,
Scott

&quot;Everything should be made as simple as possible, and no simpler.&quot;[hammer]
 
Thanks Scott for the information on AppDev. I will investigate it. It really does help when you pros give me some advice that gets me back on track. I have spent hours trying to figure something out and then I put a question in and within a short time I have it running. The technical question post is a real help and I am sure as everyone must feel who has difficulties in programming a huge relief when there is an answer! Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top