|
Can anyone help. I'm trying to set the font of a label property to 'strikeout' by clicking on a command button. When I do this I get "Property Strikeout is read only". I've put in this code
Public ReadOnly Property Strikeout() As Boolean
Get
End Get
End Property
but whatever I put in between the Get & End Get statement isn't an accepted value. All MSDN info is only general not specific. This is probably simple but I just can't get passed it.
|
|
|
|
|
You will have to create a new Font instance:
label1.Font = new Font(label1.Font, FontStyle.Strikeout)
|
|
|
|
|
Thank you very much that works well. The next step is to apply the strikeout to a checkedlistbox line when it is checked. Can certainly determine if the line has been checked but need to apply strikeout to only one line at a time.
|
|
|
|
|
This is a bit more tricky, because the CheckedListBox doesn't support this by default. First you will have make your own CheckedListBox by inheriting from the normal CheckedListBox class. Then override the OnDrawItem method and implement it the way you want.
The easiest way to implement it should be to call the base implementation and just draw a line over the whole item when it is checked. Other possibility would be to get Reflector and look into the default implementation to get a feeling for what has to be implemented.
|
|
|
|
|
Thank you for the info so far. I had a quick look at creating a custom control but I'm a bit lost ( haven't had much experience with Visual Studio yet, mainly VB6). I don't have to have the strikeout, even a color change might do, as long as it is more noticable than the check box but I will try different ways.
|
|
|
|
|
If you want the text of any item of a CheckedListBox to look different, in any way!, from the others, you'll have to ownerdraw the list items, just like Christian said.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am currently attempting to design an easy to use Order for about 24 different pruducts using Visual Basic 6.0. I am planning on using a database to keep track of previous orders and to hold the pruduct list. However, I am having trouble toring to making the 24 different text boxes to only allow the user to enter numbers only. I have tried going through the different properties and cant figure it out. Can anyone help me with the code or provide me a link with a detailed example? Also, if anyone happens to know where I can go to get a good example of a database driven order form that allow easy changes to pruduct numbers?
|
|
|
|
|
Does VB6 allow you to catch the WM_CHAR message ? If so, you can check if it's a number, and ignore it if it's not.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Public Function procNumOnly(KeyAscii) As Integer
If ((KeyAscii < Asc("0")) Or KeyAscii > Asc("9")) _
And (KeyAscii <> 8) And (KeyAscii <> 13) And (KeyAscii <> 46) Then
procNumOnly = 0
Else
procNumOnly = KeyAscii
End If
End Function
Private Sub txtPrice_KeyPress(KeyAscii As Integer)
KeyAscii = procNumOnly(KeyAscii)
End Sub
<italic>Work hard, Work effectively.
|
|
|
|
|
Yulianto. wrote:
And (KeyAscii <> 8) And (KeyAscii <> 13) And (KeyAscii <> 46) Then
Wow - VB6 doesn't have IsNumeric, or IsControlKey ? Assuming you're safe to use hard coded ascii values, wouldn't it be better to accept the entire control range ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
good morning guys.
i get a problem automatind excel in vb6. when i'm working with Range Property everything is alright. but each time i use with the ActiveCell or ActiveSheet in my codes, compiler return error 91; Object Not Set. Plus, i make sure that i activate the sheet i'm working with. here's some codes i use:
Wks.Activate
ActiveCell.Value="Visual Basic"
-------------------------------------
thank you for your help
|
|
|
|
|
Is thr any free software available on net for designing toolbar and UI controls like button ect.;)
|
|
|
|
|
Doesn't the IDE let you do that ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
IDE allows me to de it but i want some thing more attractive, like buttons and pictures on it...scrollbar grid ect. My toolbar's (application vb.net )
depend on the windows installed..io want to make it os indpendent...
|
|
|
|
|
misspoo22 wrote:
My toolbar's (application vb.net )
depend on the windows installed..io want to make it os indpendent...
You can't write an OS indepentent application in VB.NET, at least I don't think you can.
If you want your buttons, etc to be pretty, you need to write your own.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
What abt the tools available for designing toolbar, but thr a all payed...
|
|
|
|
|
I assume the English translation is 'there are commercial tools for designing toolbars, but I want a free one'.
I have no idea what tools you mean - VS.NET will show your controls as they are, you may be thinking of commercial libraries to offer UI components that are not standard ( i.e. make your app look like Office or Visual Studio ), there are free components on this very site, but the commercial ones are obviously more extensive and better supported.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks ,Yes i am talking about the free components. If they are present on this site itself..Please send me the link of the exact server location if you can.;) well i got some link is this the same thing you were talking about
http://www.codeproject.com/vb/net/
|
|
|
|
|
misspoo22 wrote:
well i got some link is this the same thing you were talking about
Yes. If you want something more fancy, or more focused on what you need, you will have to pay for it. Especially in VB, VB has always existed more on the basis of buying components to make it do stuff, than that of coders sharing their work.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Can i capture keystroke or can i activate any application by using combination of keys. please help.
|
|
|
|
|
Do you want the keypress event in an application, or to write a global keyboard hook ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
yes i want keyboard hook but in VB6.0
|
|
|
|
|
According to google[^], there's plenty of info available.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hiya all, I'm unsure whether to place the question here or in asp.net, but opted for here seeing as I use VB.Net as codebehind.
I'm trying to meassure how long time two differnet segments of code uses to excute, approximately - it is only for comparing and personal interest.
However - I end up with results which I just can't seem to accept as being correct.
What I do is use "ticks" at start and end and subtract the two, thinking this would give me the time in ticks between the two... like this:
dim longStart, longEnd as long
dim doubleDiff as double
doubleDiff = 0
longStart = DateTime.Now.Ticks
For intCounter As Integer = 0 To 24999
Next
longEnd = DateTime.Now.Ticks
doubleDiff = longEnd - longStart
doubleDiff = doubleDiff / TimeSpan.TicksPerMillisecond
longStart = DateTime.Now.Ticks
For intCounter As Integer = 0 To 24999
Next
longEnd = DateTime.Now.Ticks
doubleDiff = longEnd - longStart
doubleDiff = doubleDiff / TimeSpan.TicksPerMillisecond
However - this presents me with some odd result. Sometimes the former code segment displays as 0. Sometimes the second codesegment presents as one number and sometimes as that number plus what the first codesegment has displayed as.
So if I for instance get 15.12 as result for segment one, then I will often get X or X+15.12 for the second segment on subsequent runs. X often also is the result of first segment of code multipled with 10 which leads me for sure to belive something is going on which shouldn't be.
I am doing something terrible wrong, but I don't know what - it should be pretty straight forward...
Anybody got some advice for me, or can smack me on the head so I find out what is wrong
---------------------------
127.0.0.1 - Sweet 127.0.0.1
|
|
|
|
|
If you read the documentation for DateTime.Now() , you'll find that the accuracy and resolution of the clock is very dependant on the hardware clock and only to about 10 milliseonds. Since your results are coming in very close to the clocks resolution, it is very possible to get calculated results of 0 milliseconds, even while using the Ticks counter.
The number of Ticks per Millisecond is constant at 10,000 to 1. But, there is no way in hell that DateTime.Now() will ever return a Tick count that accurately.
If you want to more accurately time something that can execute quicker than about 20 milliseconds, you'll have to use a high-resolution timer library. The .NET Framework doesn't come with one, well, 2.0 does anyway. This library, or class, will have to use the Win32 functions QueryPerformanceCounter and QueryPerformanceFrequency to get sub-millisecond accuracy. You can find an example of writing a wrapper class for these functions here[^] on MSDN. It's written in C#, but is easily converted to VB.NET if need be. There's even a few articles here on CodeProject. Just search the articles for "QueryPerformanceCounter".
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|