|
|
Use VB.Net? If I remember correctly there is a Date type in VB and you just need to do something like:
Dim myDate as Date
myDate = Now()
I could be wrong it's over 5 years since I last used VB6 and my memory's not what it was.
If you are using VB6 then my suggestion (for your previous question) to use the ErrorProvider won't help you (it's a VB.Net control).
Regards
David R
|
|
|
|
|
ShayanTanwir wrote: is there any better way of doing this?
yes there is.
For one, choose a modern language. VB6 is 20 years old and obsolete; today's Basic is called VB.NET
Once you are sure about the language choice, learn it in a decent way: follow a course, or buy and study a book (a physical book, not an e-book, and no I am not recommending any particular one, go browse some in a book store).
Then read some of the articles here on CodeProject and start experimenting.
Don't try and do it without good fundamentals, it does not work.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Luc Pattyn wrote: VB6 is 20 years old
No its not, it only came out about 1999. If I've told you once, I've told you a million times, don't exaggerate!
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Ashfield wrote: VB6 is 20 years old ... No its not
Correction: VB is 20 years old and VB6, its last incantation, is now obsolete.
Is that better?
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Yes, much. You mustn't confuse those poor souls who are still using it - most of them aren't 20 years old
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
happy to oblige
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Ashfield wrote: No its not, it only came out about 1999
Excuse me, but I beg to differ. I clearly remember VB6 rearing its ugly head somewhere toward the end of 1998. Oh, how I loathe the Dark Ages.
|
|
|
|
|
Quite possibly. To many beers ago to remember
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
If you're going to ask questions on any forum, not just CP's, you really need to specify that you're using VB6. Everyone will assume you're using VB.NET since VB6 has not been support by Microsoft for quite some time now.
|
|
|
|
|
We should boycott all VB6 questions in the forum!!!!
Until I get stuck on some dumb legacy code and need help.
It would help if the OP would be a bit more specific. Very rarely is there too much info. in the orig. post.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
|
--> dim currentTime as Date=DateTime.Now()
--> Me.TextBox.Text=currentTime.ToShortDate()
--> Now it will work.... Enjoy....
J A Nasir K
|
|
|
|
|
Hi
- command button cannot be named "new record", it should be named "new_record" or "NewRecord", no space is allowed in the name of object, or you are talking about "caption" ?
' in CommandButton Click
Text1 = Time()
Text2 = Date
hth
Samir R. Ibrahim
|
|
|
|
|
Hi,
In code a loop has perfomed an heavy task in minutes. There is a cancel button on the form which must immediately cancels the currently running loop inside a procedure.
How could you do that? How could you stop all the running tasks (loop) inside the form and execute the Button1_Click procedure which should closes the form when it gets clicked at once. I tought the easiest way might be the just immediately closing the form or disposing it. But when I push the button it is not responding on time because of running loops inside another procedure with even application.doevents statement inside the loops.
But I beleive that there should be more professional approaches to do that and I have no idea about it.
Thank You.
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
You have to move the tasks to a background thread. Then the UI will become responsive and you can tell the thread to stop from in there.
Have a look at the BackgroundWorker class.
|
|
|
|
|
You could try using DoEvents in the loop.
This might be simpler than using BackGroundWorker but not as resposive.
See 'My.Application.DoEvents Method' in VB help.
Regards
David R
|
|
|
|
|
that is bad practice, a waste of CPU cycles and potentially dangerous.
Any work that takes or may take more than say 30 msec should be handled by another thread, which could be from a ThreadPool, a BackgroundWorker, whatever.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
DoEvents is the kiddie-size method of handling this problem. It also introduces adult-size problems if not handled correctly.
|
|
|
|
|
Hello Everyone
i have made a project of stock control. This is the coding for my save records command button. this is a presence check for the four text boxes which have different range
If Text3 = "" Or Text4 = "" Or Text5 = "" Or Text6 = "" Then
MsgBox "Please Fill in the required fields", vbInformation, "Presence Error"
Else
Adodc1.Recordset.Save
MsgBox "Record has been saved"
End If
the problem is that i want a different msg box message for each text box. how can i do that?
please help me!
ST
|
|
|
|
|
Multiple If statements, one for each TextBox maybe??
|
|
|
|
|
Something like this...
If text3="" Then
MsgBox "Enter value for textbox3"
Else If text4="" Then
MsgBox "Enter value for textbox4"
Else If text5="" Then
MsgBox "Enter value for textbox5"
Else If text6="" Then
MsgBox "Enter value for textbox6"
Else
Adodc1.Recordset.Save
MsgBox "Record has been saved"
End If
|
|
|
|
|
This is giving a compile error
Thanks for the help!
regards
ST
|
|
|
|
|
Its not that hard to figure it out!
Where it says text3="" you just need to type text3.text=""!
Lloyd J. Atkinson
I used Vista the other day. It was also the last time I will ever voluntarily use the damn thing. I would rather use Windows 1.0 just because it dosent literally chew the RAM just to draw pretty colours.
|
|
|
|
|
You can use the System.Windows.Forms.ErrorProvider to do this.
Or you could deal with them one at a time by having:
If Text3 = "" Then
MsgBox "Please Fill in the Text3 field", vbInformation, "Presence Error"
ElseIf Text4 = "" Then
MsgBox "Please Fill in the Text4 field", vbInformation, "Presence Error"
ElseIf Text5 = "" Then
MsgBox "Please Fill in the Text5 field", vbInformation, "Presence Error"
ElseIf Text6 = "" Then
MsgBox "Please Fill in the Text6 field", vbInformation, "Presence Error"
Else
Adodc1.Recordset.Save
MsgBox "Record has been saved"
End If
If you do the latter, then the user could be faced with four message boxes.
By the way, I think you should use MessageBox.Show() rather tham MsgBox - see the How to: Display Message Boxes topic in VB help.
Regards
David R
|
|
|
|