473,324 Members | 2,417 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,324 software developers and data experts.

counter for new form?

hi, i have an application that makes a new form of itself, but i want to have
the name of the form to be the number, ex when u click "new" in word, it
makes "new document 2" then "new document 3" and so on, how can i impliment
this?
Nov 21 '05 #1
5 1164
awsome that works, thanks
Nov 21 '05 #2
ng
Use a static variable and increment it by 1 each time.

Tom
iwdu15 wrote:
hi, i have an application that makes a new form of itself, but i want to have
the name of the form to be the number, ex when u click "new" in word, it
makes "new document 2" then "new document 3" and so on, how can i impliment
this?

Nov 21 '05 #3
i tried that by this code:

Private Sub mnunew_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles mnunew.Click

Call NewForm()

End Sub

Private Sub NewForm()

Static intpages As Integer

intpages += 1
Dim frm As New Form1
frm.Text = "New Document" & intpages
FileDirectory = Nothing
frm.Show()

End Sub

filedirectory is just an uninvolved variable, but each time it creates a new
form it has the same thing "New Document1"
Nov 21 '05 #4
iwdu15 wrote:
i tried that by this code:

Private Sub mnunew_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles mnunew.Click

Call NewForm()

End Sub

Private Sub NewForm()

Static intpages As Integer

intpages += 1
Dim frm As New Form1
frm.Text = "New Document" & intpages
FileDirectory = Nothing
frm.Show()

End Sub

filedirectory is just an uninvolved variable, but each time it creates a new
form it has the same thing "New Document1"


if you are doing it that way why not have a property that stores the
value...

Static mPageNumber As Integer

Private Sub mnunew_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles mnunew.Click

Call NewForm()

End Sub

Private Sub NewForm()

Dim frm As New Form1
mPageNumber += 1
frm.FormNumber = mPageNumber
FileDirectory = Nothing
frm.Show()

End Sub

public property FormNumber() as Intger
get
return mPageNumber
end get
set(value as integer)
mPageNumber = value
me.text = "New Document" & mPageNumber
end set
end property
Nov 21 '05 #5
awsome that works, thanks
Nov 21 '05 #6

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

Similar topics

1
by: inderjit S Gabrie | last post by:
Hi all Here is the scenerio ...is it possibly to do this... i am getting valid course dates output on to a web which i have designed ....all is okay so far , look at the following web url ...
2
by: phoenix | last post by:
Hi, I wonder if the following is even possible : Suppose I have a page with a set of hyperlinks on it. Each time a hyperlink is clicked a new window is opened. What i basically want is the...
2
by: Carl Gilbert | last post by:
Hi I'm having problems with the following code. All I want to do is keep a counter on the page for every new image recieved without deviating from the "for" and "event". <OBJECT ID="CamImage1"...
8
by: Prometheus Research | last post by:
http://newyork.craigslist.org/eng/34043771.html We need a JavaScript component which will auto-submit a form after a set period has elapsed. The component must display a counter that dynamically...
2
by: Ben Barnes | last post by:
Hi, Having an issue with a pretty standard javascript text counter. The counter works fine when a user physically enters text into a textbox but shoudl the textbox have a value prefilled then...
0
by: Earl Anderson | last post by:
KB Article Q140908 provided the following function to create an Auto Incrementing Counter: Function Next_Custom_Counter () On Error GoTo Next_Custom_Counter_Err Dim MyDB As Database Dim...
1
by: Tempy | last post by:
Hi all, i am a total newbie to this game and have a tblCounter with a field of counter that i need to incriment by one when a certain form is opened, please could somebody come to my assistance ...
1
by: Drew | last post by:
I would like to find out how to build a click counter using VB.NET. This is not a run-of-the-mill click counter (i.e. for web use), but a novelty app that counts how many times you click...
14
by: Newbie | last post by:
Can anyone get this counter working in ASP.NET 1.1 in VB.NET 2003 like in the demo project? http://www.allscoop.com/netcounter.php I can get in to work in ASP.NET 2.0, but not ASP.NET 1.1,...
5
by: jasonchan | last post by:
How would you set up a counter in javascript that goes from 5 to 0 This is what i have so far and it is not displaying in the div container "counter" for some reason... <!DOCTYPE html PUBLIC...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.