Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Statusbar panels

Posted on 2004-10-07
10
Medium Priority
?
317 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

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

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.

Question has a verified solution.

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

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

670 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