|
|
Noone is just going to hand you a completed project. YOU have to write it yourself. We can help with that part, but as for doing your job for you, forget it.
|
|
|
|
|
Hi Dave
I am new in forum, and I am still learning vb.net
I know vb6 (good) and I am Professional in Foxpro (VFP)
I am an active member on many foxpro forums, and I have my own blog for foxpro
I am telling that to ask a question
in foxite forum, if someone ask this question I can give him
#1 already posted message to his answer.
#2 a link to web page that solve his answer.
#3 a link to my blog that I had already write a document on this question.
Is the rule in here that you don't answer question posted if the person who post
the question did not make some effort?
I am with "make some effort, then post your problem if you get stuck"
Can you point please to #1 #2 #3 which are acceptable and which are not?
Sorry If I ask to much, I Just want to make sure I don't make wrong when posting Q or A
TIA
Samir R. Ibrahim
|
|
|
|
|
Samir Ibrahim wrote: Is the rule in here that you don't answer question posted if the person who post
the question did not make some effort?
Yes. There's just WAY too many "questions" asking for code. There's too much copy'n'paste coding going on in the world and too many "students" who just want their assignments done for them.
So, when someone asks for code, it's chances are VERY high that it's not to help them write their own code.
You can put up any answer you want. I've gotten so tired of "programmers" want their code written for them, they get the standard answer of "if you want code, WRITE IT!"
|
|
|
|
|
|
I think the other point is also that VB6 is no longer supported and you are doing NEW development in it. You originally asked for a solution, not guidance and to top it of you consider it urgent. It is only urgent to YOU.
These points will insure you get no help from the forum which is here to help, not supply code. Seriously, trash the VB6 and move to .net NOW
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
If you insist on using VB6, Google for "FileSystemObject". The logic is "recursive", so you may want to Google that too.
And yes, you asked for the code, not a push in the right direction.
|
|
|
|
|
hi all
i want to import calendar from app such as outlook and hotmail in to my program, which is a template of Diary
does any know how i can go about this or how i can create this in vb.net
|
|
|
|
|
Use the APIs/COM objects
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
i don't want to import it permanetly,it only for, when the user logs in their account in my program and want to view their calendar from hotmail for example,
|
|
|
|
|
I need to populate a combobox with a list of the past 20 years.
So I get
2009
2008
2007
...
I have
For x As Integer = Date.Now.Year - 20 To Date.Now.Year Step -1<br />
form.YearFromComboBox.Items.Add(x.ToString())<br />
Next
but the loop never runs in code. What am I doing wrong please (apart from being in charge of a computer )?
|
|
|
|
|
The first problem with the code, as posted is that your list will be reversed.
i.e. it will give
1989
1990
1991
........
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Of course. I've been staring at this darn thing for far too long today.
Thanks.
|
|
|
|
|
kanchoette wrote: I've been staring at this darn thing for far too long today
I know that feeling.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Dim X as integer
for x = Cint(date.Now.year) to (Cint(Date.Now.Year)-20) step - 1
YearFromCoomboBox.items.add(x)
next
|
|
|
|
|
Curious why you are using CInt for this? The Year property already is an Integer.
Or you should be consistent and convert every value:
Dim x As Integer
For x = CInt(Cdate(CDate(Date).Now).Year) to (CInt(CDate(CDate(Date).Now).Year) - CInt(20)) step CInt(-CInt(1))
YearFromCoomboBox.items.add(CStr(CInt(x)))
Next
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
For i As Integer = 0 To 20
MsgBox(Now.AddYears(i * -1).ToString("yyyy"))
Next
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
Don't call the Now method repeatedly, that is bad practice. In this specific case it's quite unlikely, but the reason is that the value returned by Now changes, so you can get different values from one call to the next. Get the value into a variable, and use the variable repeatedly.
When you loop from a higher value to a lower, you have to put the higher value first in the For statement:
Dim year As Integer = DateTime.Now.Year
For x As Integer = year To year - 20 Step -1
form.YearFromComboBox.Items.Add(x.ToString())
Next
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi Gufa
See the code below
For I = Now.Year To Now.Year - 20 Step -1
Me.ComboBox1.Items.Add(CStr(I))
Next
I am not posting to show you my answer, but to ask you some question
I am still learning VB.Net so I am searching for answers
#1 You mention above in previous reply that using Now recursively is not best practice,
Can i know why.
#2 Is using .net convert function such as x.ToString is better than CStr(x) ? and why.
TIA
Samir R. Ibrahim
|
|
|
|
|
Thecaptin wrote: #1 You mention above in previous reply that using Now recursively is not best practice,
Can i know why.
The value returned from Now changes, so it could for example be 2008-12-31 23:59:59 when you call it the first time and 2009-01-01 00:00:00 the next. In your case there is a very low risk for this to happen, and it would only result in the wrong number of items in the list, but there are situations where this is much more likely to happen, and where it will have a much more serious result. That is why it's a bad practice to call the Now method repeatedly.
Thecaptin wrote: #2 Is using .net convert function such as x.ToString is better than CStr(x) ? and why.
The CStr function only does some type checking and then it calls the ToString method, so the difference it quite small.
Some will say that you should use the functions in VB, some will say that you should use the function in the framework. I lean towards the later. VB is now an object oriented language, so the Integer type has a method for converting it to a string. You don't need another function that in the end just calls the method in the Integer class anyway.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi,
Sorry for getting late to answer, I was in vacation.
Guffa wrote: The value returned from Now changes, so it could for example be 2008-12-31 23:59:59 when you call it the first time and 2009-01-01 00:00:00 the next.
That is a clever remark from your side, but my answer is "No Comment" because there is to many variables required which is necessary to use the new or old "Now" Value.
Guffa wrote: You don't need another function that in the end just calls the method in the Integer class anyway.
I had make some tests.
-As you said above, thet CStr is a wrapping function to .net ToString function. and from my test result, that is not true.
-I had made a 2 loop
Dim TimeStart, TimeElapse
TimeStart = Now.TimeOfDay
For I = 1 to 10000000
strTemp = CStr(I)
Next I
TimeElapse = Now.TimeOfDay - TimeStart
MessageBox.Show(TimeElapse)
TimeStart = Now.TimeOfDay
For I = 1 to 10000000
strTemp = I.ToString
Next I
TimeElapse = Now.TimeOfDay - TimeStart
MessageBox.Show(TimeElapse)
- 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?
if that so, then CStr is a VB Function and not in .net framework?
TIA
Samir R. Ibrahim
|
|
|
|
|
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"?
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.
|
|
|
|
|
Guffa wrote: In what way do you think that it's clever?
You take care of the possibility that the date could change during this time of period "31/12/2008 11:59:00" when using Now() in a function.
Guffa wrote: hat doesn't make sense... What variables are you talking about?
I mean Variation and demands to this application if it need to use the new Now() Value or still using the old Now() value. In some situation you need the New Now() value to be presented in the function you are creating and in sometime that is not important.
Guffa wrote: Dim w1 As New Stopwatch
Thank you for this new Info
Guffa wrote: CStr: 12487 ms., ToString: 11406 ms.
With your code, I had the same result but, with different numbers
Guffa wrote: If you take a look at the code in .Net Reflector,
I heard about .Net Reflector, never use it or know what is this used for.
Do you notice that all my question ends with ? because I am not sure. I am still learning vb.net 2 Month old ,so don't be hard on me
Thank you very much for your time and enplaning. very appreciated.
Samir R. Ibrahim
|
|
|
|
|
If my 2 group boxes are next to each other on the form, all is well.
If the 2 group boxes are one on top of each other, however, the button2 code doesn't work. Groupbox1 is hidden, but Groupbox2 never shows.
Anyone had this problem? Is there a way to put the groupboxes on top of each other and show/hide them properly?
Thanks
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
GroupBox1.Show()
GroupBox2.Hide()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
'GroupBox1.SendToBack()
GroupBox1.Hide()
GroupBox2.Show()
'GroupBox2.BringToFront()
End Sub
|
|
|
|
|
hi
have you try to use GroupBox1.Visible = True/False
instead of Hide()/Show()?
regards
|
|
|
|