Click here to Skip to main content
15,910,009 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: searching all types of files in all drives Pin
Dave Kreskowiak6-Feb-09 18:59
mveDave Kreskowiak6-Feb-09 18:59 
GeneralRe: searching all types of files in all drives Pin
Samir Ibrahim7-Feb-09 6:50
Samir Ibrahim7-Feb-09 6:50 
GeneralRe: searching all types of files in all drives Pin
Dave Kreskowiak7-Feb-09 9:02
mveDave Kreskowiak7-Feb-09 9:02 
General[Message Deleted] Pin
spruha3698-Feb-09 19:00
spruha3698-Feb-09 19:00 
GeneralRe: searching all types of files in all drives Pin
Mycroft Holmes8-Feb-09 21:31
professionalMycroft Holmes8-Feb-09 21:31 
GeneralRe: searching all types of files in all drives Pin
Dave Kreskowiak9-Feb-09 1:48
mveDave Kreskowiak9-Feb-09 1:48 
Questioncode to import calendars from application such as outlook,hotmail, Gmail Pin
naria20066-Feb-09 2:58
naria20066-Feb-09 2:58 
AnswerRe: code to import calendars from application such as outlook,hotmail, Gmail Pin
Steven J Jowett6-Feb-09 3:00
Steven J Jowett6-Feb-09 3:00 
GeneralRe: code to import calendars from application such as outlook,hotmail, Gmail Pin
naria20066-Feb-09 3:15
naria20066-Feb-09 3:15 
QuestionBasic looping problem Pin
kanchoette6-Feb-09 2:32
kanchoette6-Feb-09 2:32 
AnswerRe: Basic looping problem Pin
Henry Minute6-Feb-09 2:37
Henry Minute6-Feb-09 2:37 
GeneralRe: Basic looping problem Pin
kanchoette6-Feb-09 2:43
kanchoette6-Feb-09 2:43 
GeneralRe: Basic looping problem Pin
Henry Minute6-Feb-09 2:52
Henry Minute6-Feb-09 2:52 
AnswerRe: Basic looping problem Pin
Mr Oizo6-Feb-09 3:12
Mr Oizo6-Feb-09 3:12 
GeneralRe: Basic looping problem Pin
Guffa6-Feb-09 7:53
Guffa6-Feb-09 7:53 
AnswerRe: Basic looping problem Pin
nlarson116-Feb-09 8:14
nlarson116-Feb-09 8:14 
AnswerRe: Basic looping problem Pin
Guffa7-Feb-09 5:24
Guffa7-Feb-09 5:24 
GeneralRe: Basic looping problem Pin
Samir Ibrahim7-Feb-09 5:49
Samir Ibrahim7-Feb-09 5:49 
GeneralRe: Basic looping problem Pin
Guffa7-Feb-09 8:59
Guffa7-Feb-09 8:59 
GeneralRe: Basic looping problem Pin
Samir Ibrahim10-Feb-09 2:41
Samir Ibrahim10-Feb-09 2:41 
GeneralRe: Basic looping problem Pin
Guffa10-Feb-09 6:43
Guffa10-Feb-09 6:43 
Samir Ibrahim wrote:
That is a clever remark from your side


In what way do you think that it's clever?

Samir Ibrahim wrote:
but my answer is "No Comment"


As in "I'm in to it up to my ears, and in that situation it's best keep your mouth shut"? Wink | ;)

Samir Ibrahim wrote:
because there is to many variables required which is necessary to use the new or old "Now" Value.


That doesn't make sense... What variables are you talking about?

Samir Ibrahim wrote:
- I compare the execution time of both codes
- The result was they are in the same speed until counter "I" is over 1000000 when I is over, CStr is 17 to 30% faster than .ToString
Can you confirm?


Of course not. With as few iterations as you used, you are way below the resolution of the system clock. you should use something that gives a better resolution:
Dim w1 As New Stopwatch, w2 As New Stopwatch
Dim strTemp As String

w1.Start()
For i = 1 To 100000000
	strTemp = CStr(i)
Next i
w1.Stop()

w2.Start()
For i = 1 To 100000000
	strTemp = i.ToString
Next i
w2.Stop()

TextBox1.Text = String.Format("CStr: {0} ms., ToString: {1} ms.", w1.ElapsedMilliseconds, w2.ElapsedMilliseconds)

Result of my test run:

CStr: 12487 ms., ToString: 11406 ms.

According to your test, CStr should be 17-30% faster, but instead ToString is about 9% faster. This is consistent with the code that is generated. If you take a look at the code in .Net Reflector, you see that this statement:

strTemp = CStr(i)

actually compiles into this code:

strTemp = Conversions.ToString(i)

If you look at the Conversions.ToString(Int32) method, it looks like this:
Public Shared Function ToString(ByVal Value As Integer) As String
    Return Value.ToString(Nothing, Nothing)
End Function

If that's not a plain wrapper for the Int32.ToString method, I don't know what is...

Despite everything, the person most likely to be fooling you next is yourself.

GeneralRe: Basic looping problem Pin
Samir Ibrahim10-Feb-09 7:31
Samir Ibrahim10-Feb-09 7:31 
QuestionGroupbox problem Pin
cstrader2326-Feb-09 2:20
cstrader2326-Feb-09 2:20 
AnswerRe: Groupbox problem Pin
JoeSharp6-Feb-09 2:42
JoeSharp6-Feb-09 2:42 
GeneralRe: Groupbox problem Pin
cstrader2326-Feb-09 3:13
cstrader2326-Feb-09 3:13 

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.