Solved

Statusbar panels

Posted on 2004-10-07
10
290 Views
Last Modified: 2010-04-23
I'm using vb.net 2002 and I was wondering if there is a way to show and use other controls inside of a statusbar.  For example StatusBarPanel1 would contain some text and a NumericUpDown1 and StatusBarPanel2 would contain Button1 and both the controls could be used as if they were part of the form and not part of the statusbar. If it could be done can someone give a good commented code example of how to do it?
0
Comment
Question by:teamdad
  • 6
  • 3
10 Comments
 
LVL 4

Expert Comment

by:eozz_2000
ID: 12255176
   Private Sub ShowButton()
        Dim nud As New NumericUpDown()
        With nud
            .Minimum = 0
            .Maximum = 15
            .Name = "nud"
            .ThousandsSeparator = True
        End With
        Me.StatusBar1.Controls.Add(nud)
    End Sub
0
 
LVL 4

Expert Comment

by:eozz_2000
ID: 12255203
I have tried with this numericUpDown object and with a button
0
 
LVL 4

Expert Comment

by:eozz_2000
ID: 12255245
Before adding the second and following controls you must calculate the x coordinate of the control you want to place:

Private Sub ShowButton()
    Dim i, x As Integer
    For i = 0 To Me.StatusBar1.Controls.Count - 1
        x += Me.StatusBar1.Controls(i).Width
    Next
    Dim nud As New NumericUpDown()
    With nud
        .Left = x
        .Minimum = 0
        .Maximum = 15
    End With
    Me.StatusBar1.Controls.Add(nud)
End Sub
0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 

Author Comment

by:teamdad
ID: 12255267
So, I use both pieces of code together?  they both have Private Sub ShowButton() and they can't have the same instance.
0
 
LVL 4

Expert Comment

by:eozz_2000
ID: 12255298
No, the second code is the correct, because the previous was putting all the controls the others back of the first control.

The second code make the things better.
0
 

Author Comment

by:teamdad
ID: 12255443
With a blank StatusBar1 on a form and using your code it doesn't add anything to the StatusBar. There isn't any errors just nothing on the statusbar.
0
 

Author Comment

by:teamdad
ID: 12255576
I added your code to my form load and it works without it being in it's own sub.  Is there any way I can add text either before or after the code?
0
 
LVL 18

Expert Comment

by:armoghan
ID: 12256615
0
 
LVL 4

Expert Comment

by:eozz_2000
ID: 12259030
When you create the textBox, comboBox, button or any other object to your statusBar you can set its text.

If you have added buttons you can add handlers to give them functionality:

dim btn as new Button()
with btn
  'The code to make this button unique
end with
addhandler btn.Click, addressof(me.btn_Click)

private sub btn_Click(sender as object, e as eventArgs)
  'Here you put the code to handle the click event for the button.
end sub
0
 
LVL 4

Accepted Solution

by:
eozz_2000 earned 500 total points
ID: 12259048
I don't know why you say that the code I send on 10/07/2004 07:51PM CDT doesn't works, I have proved it right now and it is so well.

I hope this could help you :)
0

Featured Post

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question