Click here to Skip to main content
15,909,742 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Testing if a varible is null Pin
Thomas Krojer4-Feb-10 21:47
Thomas Krojer4-Feb-10 21:47 
QuestionHow do I update a progress bar that I create at runtime. Pin
castingflame3-Feb-10 7:16
castingflame3-Feb-10 7:16 
AnswerRe: How do I update a progress bar that I create at runtime. Pin
Luc Pattyn3-Feb-10 7:37
sitebuilderLuc Pattyn3-Feb-10 7:37 
AnswerRe: How do I update a progress bar that I create at runtime. Pin
William Winner4-Feb-10 7:23
William Winner4-Feb-10 7:23 
GeneralRe: How do I update a progress bar that I create at runtime. Pin
David Skelly4-Feb-10 22:34
David Skelly4-Feb-10 22:34 
QuestionSchema.Add returns Illegal characters in path. Pin
c_crookston3-Feb-10 6:16
c_crookston3-Feb-10 6:16 
AnswerRe: Schema.Add returns Illegal characters in path. Pin
c_crookston3-Feb-10 6:29
c_crookston3-Feb-10 6:29 
QuestionCan not set the name property of a timer at runtime - VB.NET Pin
castingflame3-Feb-10 2:07
castingflame3-Feb-10 2:07 
Hi there.

Sorry if this is long winded. I am relatively new to programming and have managed so far with google and a lot of patience! I am having a problem naming timer contols at runtime. This is what I am trying to achieve.


1. I connect to my dataset and to my first record
2. I create a loop for the recordset
3. I create various objects on a form and name them using the info in the dataset

I also need to create timers and name them using the first field of my dataset. It needs to be dynamic as its database driven. There could be as many as 100 timers at any one point.

I can use the Button.name = "myname" fine for most controls
but doing a Timer.name does not work


This is some of my code (some variable values not shown):




'Counter to move through the database Dataset
Dim RecordsCount As Integer
RecordsCount = ManagerDataSet.Robots.Count



'Declare name incremented with record number to make it unique
Dim btnSSName(RecordsCount) As Button



For myLoop = 0 To (RecordsCount - 1)

'Create a button
btnSSName(myLoop) = New Button()
btnSSName(myLoop).Location = New Drawing.Point(btnSSPosVer, lblposHoz) 'lblposVer, ProgBarPosHoz)
btnSSName(myLoop).Name = "btnSS" + currentRobot
btnSSName(myLoop).Text = currentRobot
btnSSName(myLoop).Width = 70
btnSSName(myLoop).Height = 23
btnSSName(myLoop).BackColor = Color.Red
btnSSName(myLoop).ForeColor = Color.White
TabControl1.TabPages(0).Controls.Add(btnSSName(myLoop))


next myLoop



That all works great for populating objects on the form.



When I create a timer in a similar way:



Dim tmr(RecordsCount) As Timer


tmr(myLoop) = New Timer
tmr(myLoop).Interval = whatevermydatasetrecordis
tmr(myLoop).Name = "myuniquename"
AddHandler tmr(myLoop).Tick, AddressOf hndlifespan


*****The Problem ******

Using . .

tmr(myLoop).Name = "myuniquename"

I get a error of 'Name' is not a member of 'System.Windows.Forms.Timer'



When one of my dynamicly created buttons is pressed it goes to the dynamically created button click handler. This in turn knows which button was pressed by asking its name. At this point I want to launch a specific timer based on the button name.

So if the button "Alpha" was pressed I want to enable the "Alpha" timer (that was created dynamically from the dataset with its associated interval).


I have created a timer at design time which does this:

Friend WithEvents billy As System.Windows.Forms.Timer
Me.billy = New System.Windows.Forms.Timer(Me.components)


If I do the same

Dim billy As Timer
billy = New Timer

The timer is stuck with the name "billy" still and I am unable to change it.
I wish to name the timer with a name that is held in a string. At the moment I acn see that

Dim myString As Timer

can not work as It is an assigned string

so

Dim tmr(CInt(myString)) As Timer
tmr(CInt(myStringt)) = New Timer
AddHandler tmr(CInt(myString)).Tick, AddressOf hndlifespan


does not flag errors in intellisense but I have no idea why it asked me to convert my string into an Integer and if it will work.




I am burned out and lost !!!!!!!!



Many thanks and sorry if I made your head hurt!




Paul
AnswerRe: Can not set the name property of a timer at runtime - VB.NET Pin
Covean3-Feb-10 2:34
Covean3-Feb-10 2:34 
AnswerRe: Can not set the name property of a timer at runtime - VB.NET Pin
Luc Pattyn3-Feb-10 2:34
sitebuilderLuc Pattyn3-Feb-10 2:34 
AnswerRe: Can not set the name property of a timer at runtime - VB.NET Pin
DaveAuld3-Feb-10 2:36
professionalDaveAuld3-Feb-10 2:36 
AnswerRe: Can not set the name property of a timer at runtime - VB.NET Pin
dan!sh 3-Feb-10 2:42
professional dan!sh 3-Feb-10 2:42 
AnswerRe: Can not set the name property of a timer at runtime - VB.NET Pin
Wayne Gaylard3-Feb-10 3:03
professionalWayne Gaylard3-Feb-10 3:03 
AnswerRe: Can not set the name property of a timer at runtime - VB.NET Pin
Dave Kreskowiak3-Feb-10 3:29
mveDave Kreskowiak3-Feb-10 3:29 
GeneralRe: Can not set the name property of a timer at runtime - VB.NET Pin
castingflame3-Feb-10 7:01
castingflame3-Feb-10 7:01 
GeneralRe: Can not set the name property of a timer at runtime - VB.NET Pin
Paul Roseby3-Feb-10 10:25
Paul Roseby3-Feb-10 10:25 
GeneralRe: Can not set the name property of a timer at runtime - VB.NET Pin
Paul Roseby3-Feb-10 10:28
Paul Roseby3-Feb-10 10:28 
QuestionListView: How to link columnheader into subitem Pin
jtpaa2-Feb-10 23:44
jtpaa2-Feb-10 23:44 
AnswerRe: ListView: How to link columnheader into subitem Pin
DaveAuld3-Feb-10 0:41
professionalDaveAuld3-Feb-10 0:41 
AnswerRe: ListView: How to link columnheader into subitem Pin
DaveAuld3-Feb-10 1:06
professionalDaveAuld3-Feb-10 1:06 
GeneralRe: ListView: How to link columnheader into subitem Pin
jtpaa3-Feb-10 1:29
jtpaa3-Feb-10 1:29 
AnswerRe: ListView: How to link columnheader into subitem Pin
DaveAuld3-Feb-10 2:31
professionalDaveAuld3-Feb-10 2:31 
GeneralRe: ListView: How to link columnheader into subitem Pin
jtpaa3-Feb-10 2:54
jtpaa3-Feb-10 2:54 
GeneralRe: ListView: How to link columnheader into subitem Pin
DaveAuld3-Feb-10 3:00
professionalDaveAuld3-Feb-10 3:00 
GeneralRe: ListView: How to link columnheader into subitem Pin
JR2124-Feb-10 1:00
JR2124-Feb-10 1:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.