Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Statusbar panels

Posted on 2004-10-07
10
Medium Priority
?
320 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

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 2000 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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

886 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