|
Exaclty. But, I don't want the form to close. I want the code to unpause when the user clicks the Next button.
I could have the form close, but I would then have to process everything again and display it immediately afterwards, and that seems to be a very bad idea.
Reedmon29
|
|
|
|
|
I haven't tried doing what you need but here are some ideas that I hope they work.
You need to create custom events to pause and continue in one form and subscribe your main form to those events.
Example to create event:
<br />
Public Event PauseCode()<br />
Public Event ContinueCode()
You create this event in the form that will be controlling the pause/continue events.
Example to raise event:
<br />
RaiseEvent PauseCode() or RaiseEvent ContinueCode()
Let's call the form with events defined above ControlForm
Now in your main form you will create the ControlForm and you have to declare the methods that need to be called when events are raised.
Example to handle the PauseCode event:
<br />
AddHandler _controlForm.PauseCode, AddressOf OnPauseCode<br />
AddHandler _controlForm.ContinueCode, AddressOf OnContinueCode
Next thing you have to do is create the OnPauseCode and OnContinueCode subs in your main form. First you need to create a boolean variable such as _isPaused. Then the OnPauseCode should something like:
<br />
private Sub OnPauseCode<br />
_isPaused=true<br />
while _isPaused do nothing<br />
end while<br />
end sub
And the only thing that the sub OnContinueCode does is to change the variable _isPaused to false.
Let me know if it works, I could use probably use it.
|
|
|
|
|
That works... I had the Do Nothing while loop run Application.DoEvents(), because otherwise the forms would not draw.
Thank you very much for your help.
Reedmon29
|
|
|
|
|
You'r code can't "pause" while waiting for the Next button to be clicked. If it did, there's no way it could respond to the button click.
If your code is supposed to modify the form layout between "Next" button clicks, like a PowerPoint presentation, you'll have to maintain state information about what "page" the user is looking at. Code in the click handler for the "Next" button would have to increment the counter to the next page and call a function to modify the controls according to what page should be viewed.
When you get to the last page, the "Finish" button click handler would set the forms return value, its .DialogResult property, to whatever you need. BTW, you'd show this form using .ShowDialog() so you can get a return value, just like MessageBox returns.
This is what I've gathered your trying to get at. I really can't tell for sure because you haven't been very descriptive about what your trying to do with this form besides "pause" code and handle a "Next" button.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have an ASP.net Form with a record number field in it. I want to create the number automatically in sequence each time a user creates a new record, the user does not want to have to add the number manually.
The record number is of the format 2005/001 and the next record will be 2005/002 and so on, 2005 is the year so next year this must change to 2006. The records are held in a Sqlserver 2000 database table. I want to ensure that if the last record inserted to the database was 2005/004 then when the user opens the form to create a new record the Record number field will be populated with 2005/005 which is the next Record number in sequence.
I am using VB.net to code the ASP.net.
Anyone any ideas on this?
Thanks.
|
|
|
|
|
Place a column for the year and a column for the /xxx part in your table. Write the stored procedure to do the insert to accept the year, and to work out the next index to put in the xxx part based on what's in the table already. An identity column won't help, because you want to go back to 1 for the next year, right ? Then create a view that joins these two values, and do all queries on that view.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi All;
What is the difference between these two statements with uses [String} or just using String
Dim myStr As [String]() = {"One", "Two", "", "Three", "Four"}
And
Dim myStr As String() = {"One", "Two", "", "Three", "Four"}
Thanks
|
|
|
|
|
They're identical statements. There is no difference. The square brackets around the term String just mean that this is an escaped name. Normally, you can't use a name that is the same as a VB reserved word, like Case or Friend. The square brackets allow you to use the name as a type name, but only if you reffer to it using the square brackets around the name. Docs on it are here[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks for the info.
|
|
|
|
|
hello! i just want to ask how to use the ADODC control? its like a navigator control with the following commands: go top rec, next, previous and go last button. how do i set the datasource or table. i used the database access. please help!
thanks in advance.
|
|
|
|
|
How are variables saved in VB, after a user has closed the program. For example:
increment a variable everytime the program/exe is used, to show how many times the program has been used.
thnx, mike
|
|
|
|
|
|
how/where do I make a "settings file", and how do i write to it? and load information from it?
thnx, mike
|
|
|
|
|
|
Im using visual basic, I think thats VB.net? It didnt recognize some of the commands on that source code.
thnx, mike
|
|
|
|
|
'read
Dim l_string As String
Dim i As Integer
FileOpen(1, "doc.txt", OpenMode.Input)
For i = 1 To 3
Input(1, l_string)
Next i
'you will only need to do the input once so the for loop could be left out
'write the file
FileOpen(1, "doc.txt", OpenMode.Output)
Write(1, "# of times opened")
FileClose(1)
this should work, it's been a long time since i did vb6 programming. (this is vb6 btw)
I got the "memory jolt" from here[^]
Brian Van Beek
My Blog is Awesome, ok maybe not, but is still fun!!
|
|
|
|
|
I'm getting recognition problems again, its expecting "=" after FileOpen, and expecting "#" after input.
thnx, mike
|
|
|
|
|
I have a form where the startposition is set to center. Once the client moves it around on the screen I want to get the position of the screen, save it to isolated storage and then retrieve the setting the next time the program starts and position the screen where the client left it last.
I have isolated storage code working fine in the program. I just need to figure out how to get the position and then later set the position.
Has anyone tried this, and if so do you have sample code or suggestions?
Thanks
Lost in the vast sea of .NET
<a href="http://www.komputing.com/Pricelist.html">Visit my website at www.komputing.com</a>
|
|
|
|
|
Hi KreativeKai;
To get the location of the form after moving it do something like this in the form move event
Private isolatedStorageFormPosition As Point
Private Sub Form1_Move(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Move
isolatedStorageFormPosition = Me.Location
End Sub
On the Form load event this.
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Me.Location = isolatedStorageFormPosition
End Sub
Fernando
|
|
|
|
|
I used your suggestions and it works great!! Thanks!
Lost in the vast sea of .NET
<a href="http://www.komputing.com/Pricelist.html">Visit my website at www.komputing.com</a>
|
|
|
|
|
Could someone offer advise on how to code my forms to allow end users to customize the layout that gets saved for each time they use the application. Example:
The user would like the label for a text box to be First Name instead of Name and the tab order should change. They may also change the font size color, etc...
The other customization would be the user could move the control around the form. lets say this business likes to see lastname as the first text box on the form but the default install it is 5 down the list.
This should all be saved and set as the default. I could use the applications database but am concerned that it would hurt performance since I have dozens on forms and controls.
Also, how do you think the performance will be effected if every form has to go thru every control to set the customized paramaters.
Thanks
|
|
|
|
|
I am working on a Windows form and would like some help to figure out how to time out the application and lock it after a period of inactivity.
|
|
|
|
|
You might want to look into using the Application.Idle event [^]. You could probably reset a Timer (not a Forms timer!) to say 5 minutes every time this event gets called, then handle the Tick event of the Timer to lock your application.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I want to display the year on a label on my form.
How do you get the year from the date.
I have tried this to no avail:
Dim DateItem As Date
Num.Text = d.Year.ToString()
Num is the label name
Anyone any ideas?
|
|
|
|
|
'this would get today's year
num.text = Date.Now.Year.ToString
so you need to set DateItem to a date before using it.
dim DateItem as new date(2005,05,23)
num.text = DateItem.Year.ToString
|
|
|
|