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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Status Bar Changing

Status
Not open for further replies.

NetNomad312

Technical User
Jun 16, 2004
27
US
This is another of my dumb noob questions, sorry. I created a status bar for my program, and eventually wound up with 10 different tabs. I gave each one a "key" and a "tag" number, even though I don't know what these things are; I assumed one of them must be used to tell the program which one you want to edit. But I can't see any "key," "tag," or anything of the sort on the list of options for my status bar object. In the code, I found in the list of options "sbrStatus.Panel.Item.Text" and figured this was what changed the text. But how do I tell it which panel to edit? When I just typed something like sbrStatus.Panel.Item.Text = "blah", it gave me a compile error whenever I loaded the program (it will fill out the panels with data from my INI and thus is changed at startup). "Argument not optional," it says, highlighting ".Item". I don't know of a tutorial that covers status bars, is there one?
 
Here is some stuff from the MSDN website regarding the Status Bar Control.

Status Bar Contol

Panels Collection

sbrStatus.Panel.Item.Text
Your problem is that the panels property holds information on all the panels you have created. VB is telling you in the "argument not optional" error that you haven't told it which item in the collection you want to alter. (likewise I assume that the missing 's' on panel is a typo)

So to address the panels...
You could
Code:
sbrStatus.Panel[COLOR=red]s[/color].Item[COLOR=blue](1)[/color].Text ="My New Value"

or if you set the Key propert for each panel
Code:
dim strKey as string
strKey = "Panel1" ' or whatever you set it to
sbrStatus.Panel[COLOR=red]s[/color].Item[COLOR=blue](strKey)[/color].Text ="My New Value"

Hope that helps


Take Care

Matt
If at first you don't succeed, skydiving is not for you.
 
Ah, thanks. Er, another thing... it's a totally different question though, but I don't think I oughta be making too many threads here. My program is basically a launcher thing for a few other programs that would otherwise run on DOS... but they aren't taking their arguments well. I believe this is because some of the files it's looking for are in directories with names that have spaces (part of the directory name is usually "program files" in my case). I think this is what's causing it to not find the file I tell it to; it's probably just seeing "-file c:\program" and not the rest. Is there any way I can fix this? When I select the files using a browse box, the result includes the full name with spaces. Short of making a function that goes through the result and changes it to the ~1 thing, what can I do to work around this?
 
but I don't think I oughta be making too many threads here.

Its probably better to start a new one for a different problem.

As for the problem, you need to prefix the arguments with " which is unfortunately the string delimiter in VB. You can do it by adding Chr$(39) to each end of the arguments

Code:
dim strArg as string

strArg = "c:\prgram Files\windows\"
'strarg contains c:\program files\windowsstrarg = chr$(39) & strArg & chr$(39)
'strarg now contains [COLOR=red]"[/color]c:\program files\windows\[COLOR=red]"[/color]

Take Care

Matt
If at first you don't succeed, skydiving is not for you.
 
Ah, never considered that one, although chr$ was another thing I didn't know about VB. I assume "39" is the " character, then? Well, thanks a lot.
 
To get the best from the forum read faq222-2244 carefully.

For a list of ASCII characters see:

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top