473,396 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Problem showing spin control contents in other control

VC++ calls this a spin control, I think VB calls it an updown? Anyway
it is the control with two arrows on the right for entering numeric
values.

I have another text control that uses the spin control contents to form
a file name, i.e.

spin #1 is page # and spin #2 is total number of pages, and the text
control spells it out as

page_01_of_02

I have the code to update the text controls within the handler for the
spin controls, but it is always one behind.

I.e. here is the routine which displays the composite text string,
control name is "outputname".

Private Sub RefreshName()
OutputName.Text = "p" + PageUpDown.Text + "_of_" +
NPagesUpDown.Text
OutputName.Update()
End Sub

And all the updown control handler does is to call this.

Private Sub PageUpDown_ValueChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles PageUpDown.ValueChanged
RefreshName()
End Sub

but the result is always one off, for example if they start out as

PageUpDown.Text = 1 and NPagesUpDown = 2, I call refreshname(), I get

p1_of_2

when I click up on PageUpDown, PageUpDown.Text now = 2 but the output
is still

p1_of_2

if I then click down on PageUpDown, PageUpDown.Text now = 1 but the
output is now

p2_of_2

What am I doing wrong?

Dec 22 '05 #1
2 1867
Looks like the text isn't updated until after the ValueChanged event has
fired. Use the Value property instead

Private Sub RefreshName()
Dim sb As New System.Text.StringBuilder
sb.Append("p")
sb.Append(PageUpDown.Value.ToString())
sb.Append("_of_")
sb.Append(NPagesUpDown.Value.ToString())
OutputName.Text = sb.ToString()
OutputName.Update()
End Sub

/claes

"Drily Lit Raga" <mi*********@yahoo.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
VC++ calls this a spin control, I think VB calls it an updown? Anyway
it is the control with two arrows on the right for entering numeric
values.

I have another text control that uses the spin control contents to form
a file name, i.e.

spin #1 is page # and spin #2 is total number of pages, and the text
control spells it out as

page_01_of_02

I have the code to update the text controls within the handler for the
spin controls, but it is always one behind.

I.e. here is the routine which displays the composite text string,
control name is "outputname".

Private Sub RefreshName()
OutputName.Text = "p" + PageUpDown.Text + "_of_" +
NPagesUpDown.Text
OutputName.Update()
End Sub

And all the updown control handler does is to call this.

Private Sub PageUpDown_ValueChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles PageUpDown.ValueChanged
RefreshName()
End Sub

but the result is always one off, for example if they start out as

PageUpDown.Text = 1 and NPagesUpDown = 2, I call refreshname(), I get

p1_of_2

when I click up on PageUpDown, PageUpDown.Text now = 2 but the output
is still

p1_of_2

if I then click down on PageUpDown, PageUpDown.Text now = 1 but the
output is now

p2_of_2

What am I doing wrong?

Dec 22 '05 #2
Works great, thanks for the tip.

Dec 31 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Tat | last post by:
Hello, I have a weird show stopper here. I created a Windows application (.NET 1.1). My dev. machine is not hooked up to the Internet, neither it has firewall. I installed the app on a...
1
by: Jorge Godoy | last post by:
Hi. I have created an interface where I have a QDataBrowser and all of its editing and navigating controls and one of the displayed controls is in a QSpinBox. I have the navigation from...
2
by: Mark | last post by:
I have autorepeat turned on for a command button that increments the value in a textbox. When I click on the button and hold the mouse button down, the value in the textbox does not change. When I...
1
by: Rhy Mednick | last post by:
I'm creating a custom control (inherited from UserControl) that is displayed by other controls on the form. I would like for the control to disappear when the user clicks outside my control the...
7
by: needin4mation | last post by:
Hi, I have an Access 2002 - 2003 database. I am using Access 2003. Whenever I link an image all it shows is the filename. Not the image. Other versions of Access can link the image just fine. ...
1
by: Baiju K.U. | last post by:
Hello I have a serious problem in using the Microsoft HTML Help control for authoring help for my web site. In some machine the control works fine. But in most of the machines it is not working....
7
by: arun | last post by:
Hi I am making a booking for a tour. The tours are allowed on some days only( one on monday, other on tuesday like that). For the booking object saving, I am using a wizrd control. In the...
5
by: John Kotuby | last post by:
Hi all, This is my first time trying to creaet and use a custome Web Control in a Web Site project in ASP.NET 2.0 with VS 2005 and VB. I created the control in a separate Web Control Library...
4
by: Stewart Berman | last post by:
Is there a control equivalent to the old Spin control? The one with two hour heads and an optional textbox in the middle? The closest I can find is the NumericUpDown control and it's not the same...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.