sirbounty
asked on
Winky blinky
In my old vb6 app, I had a label with the date on it.
When the user clicked it, they were presented with a datetimepicker to change the date.
In my timer routine, I had a test loop that if the date differed from today, it would continually flash on/off red/bold until it was set back to today...
I find in http:/Q_21734897.html that to accomplish this in .net, I would be generating a new font object with every blink...
SO....there MUST be a better way...
Whatcha think?
When the user clicked it, they were presented with a datetimepicker to change the date.
In my timer routine, I had a test loop that if the date differed from today, it would continually flash on/off red/bold until it was set back to today...
I find in http:/Q_21734897.html that to accomplish this in .net, I would be generating a new font object with every blink...
SO....there MUST be a better way...
Whatcha think?
ASKER
boy..I feel stupid now... : \
Thanx.
Thanx.
No problems, it happens to all of us. :=)
ASKER
Hmm - that's generating an InvalidOperationException was unhandled... : $
ASKER
I've got
Public Class myForm
Dim fntBold as New Font(lblDate.Font, Fontstyle.bold)
Dim fntNorm as New Font(lblDate.Font, FontStyle.Regular)
It bombs on the first Dim...
Public Class myForm
Dim fntBold as New Font(lblDate.Font, Fontstyle.bold)
Dim fntNorm as New Font(lblDate.Font, FontStyle.Regular)
It bombs on the first Dim...
ASKER
This is just after my ApplicationEvents.vb's startup runs
myForm.Show()
myForm.Show()
ASKER
The error is:
Object reference not set to an instance of an object... not really helpful to me... :(
Object reference not set to an instance of an object... not really helpful to me... :(
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
<smack> - sorry - another 'dull' moment on my part... :(
Thanx again!
Thanx again!
No problem, I should have realized my stupid mistake before I posted it. :=)
If you place these two lines of code out side any sub or function, at class level then you will only create them once
Dim fntBold As New Font(Label1.Font, FontStyle.Bold)
Dim fntNorm As New Font(Label1.Font, FontStyle.Regular)
Then when you want to change the font to Bold or Normal in the label use one of these lines.
Label1.Font = fntBold
Label1.Font = fntNorm
Fernando