19-08-2005, 08:56 PM
|
#1 (permalink)
|
|
Alpha Geek
Join Date: Mar 2004
Location: Pune
Posts: 744
|
VB Doubt ?
hi there...
Got a little doubt on VB here...
these codes may be syntactically incorrect. ignore syntax
1) -
Code 1)
form_load
print "Hello"
End Sub
Code 2)
form_load
Text1.text = "Hello"
End Sub
Though both the cases seem alike.. the message is not displayed (neither in frame or window) in first case whereas it displaying properly in case 2 as am using Text Box . Why ??
2) -
There are two text boxes. i want to shift the cursor from first text box to other or u can say focus from first one to other.. i wrote the code
form_load
text2.setfocus
End Sub
It shows some error. i cant remember that. i know there may be different methods to shift the focus but why its now working by this method.
__________________
I love walking in Rain ,because no-one knows i am Crying :|
|
|
|
|
Advertisements. Register and be a member of the community to get rid of them.
|
|
Advertisement
|
|
19-08-2005, 10:20 PM
|
#2 (permalink)
|
|
Wise Old Owl
Join Date: May 2005
Location: Chennai, India, Asia, the Earth, the Solar system, the Milky Way, the Local group, this Universe.
Posts: 1,171
|
In case 1, u need to set the AutoRedraw of the form to True.
2. Prolly the textbox object is not yet drawn at this stage. So put ur code inside form_activate.
__________________
http://myxp.blogspot.com
-----------------------
Winchester 3200+ @2,500MHz
LeadTek 7900GT VOLT MODDED @ 680 core, 1800 mem
2x1GB Transcend DDR400 @ DDR454 2.5,3,3,5,1T
|
|
|
19-08-2005, 10:24 PM
|
#3 (permalink)
|
|
In The Zone
Join Date: Mar 2004
Location: Chennai
Posts: 470
|
Quote:
form_load
print "Hello"
End Sub
|
Yes ,it does not work for me too.I works if the print command is given to a command button ...Eg:
Private Sub Command1_Click()
Print "hello"
End Sub
If u need some text to be displayed as when the form is loaded ,u can use a Label Box & manipulate is visible properties.
Quote:
form_load
text2.setfocus
End Sub
|
It does not work.It gives Run time error "5"
You can use this code to set the focus to textbox 2 when the form is loaded:
Private Sub Form_Load()
Text2.TabIndex = 0
End Sub
|
|
|
19-08-2005, 10:27 PM
|
#4 (permalink)
|
|
In The Zone
Join Date: Mar 2004
Location: Chennai
Posts: 470
|
sorry I did not see siriusb's post.
If his methord works ignore mine.
|
|
|
20-08-2005, 11:36 AM
|
#5 (permalink)
|
|
Alpha Geek
Join Date: Mar 2004
Location: Pune
Posts: 744
|
Quote:
|
Originally Posted by siriusb
In case 1, u need to set the AutoRedraw of the form to True.
|
thanx.. but whats the reason for keeping Autoredraw true..
Quote:
|
Originally Posted by siriusb
2. Prolly the textbox object is not yet drawn at this stage. So put ur code inside form_activate.
|
but if somebody asks me the reason that why its not working thru form_load what shuld i tell ?? (in fact this is my assignment to give proper explanation on these)...
__________________
I love walking in Rain ,because no-one knows i am Crying :|
|
|
|
20-08-2005, 02:35 PM
|
#6 (permalink)
|
|
Wise Old Owl
Join Date: May 2005
Location: Chennai, India, Asia, the Earth, the Solar system, the Milky Way, the Local group, this Universe.
Posts: 1,171
|
If it's ur assignment, go google or msdn urself.
__________________
http://myxp.blogspot.com
-----------------------
Winchester 3200+ @2,500MHz
LeadTek 7900GT VOLT MODDED @ 680 core, 1800 mem
2x1GB Transcend DDR400 @ DDR454 2.5,3,3,5,1T
|
|
|
20-08-2005, 03:27 PM
|
#7 (permalink)
|
|
Alpha Geek
Join Date: Mar 2004
Location: Pune
Posts: 744
|
lolzz...was trying MSDN since last one hour..couldnt find a solid reason why ??....and google.. well i dont think i ll be able to find a reason on google...
anyways.. its ok..
Dipen
__________________
I love walking in Rain ,because no-one knows i am Crying :|
|
|
|
20-08-2005, 04:07 PM
|
#8 (permalink)
|
|
Wise Old Owl
Join Date: May 2005
Location: Chennai, India, Asia, the Earth, the Solar system, the Milky Way, the Local group, this Universe.
Posts: 1,171
|
Well, if u hadn't figured it out yet, you may want to learn WHEN windows (controls and forms) are painted, that is to say, the the text and lines that make the control appear the way it does. You would better understand this concept when u learn windows programming in c++.
Right now, leave drawing of controls. Whenever a part of the window is covered by another window, then the covered window is not drawn untill it is exposed. This drawing and redrawing of the window won't happen unless u specify with the autoredraw property. Try printing onto any control with a visible hdc property with autoredraw disabled and cover part of the printed text with another window and then move it away.
For form_load, this too requires understanding a bit of windows programming. Every window is created in memory as some structure and then painted later onto the screen. When the form_load is being executed, the form (and its child controls) does not yet exist. So u cannot do a setfocus method call on it.
Also, form_load is called only once in a form's lifetime, whereas form_activate is called everytime you call form.show() method and the first time the form is loaded.
__________________
http://myxp.blogspot.com
-----------------------
Winchester 3200+ @2,500MHz
LeadTek 7900GT VOLT MODDED @ 680 core, 1800 mem
2x1GB Transcend DDR400 @ DDR454 2.5,3,3,5,1T
|
|
|
21-08-2005, 10:40 PM
|
#9 (permalink)
|
|
Alpha Geek
Join Date: Mar 2004
Location: Pune
Posts: 744
|
hey buddy...
thanx.. a lot... certainly enlightened....
Dipen
__________________
I love walking in Rain ,because no-one knows i am Crying :|
|
|
|
21-08-2005, 10:44 PM
|
#10 (permalink)
|
|
Alpha Geek
Join Date: Mar 2004
Location: Pune
Posts: 744
|
hey buddy...
thanx.. a lot... certainly enlightened....
well one thing... just went to bookstore to purchase a book on VB i had 3 options.. on was Mastering VB(Microsoft), VB Bible(cant remember),one book of Princeton..and one called VB black book...
VB black book looked good.. even asked him which one has greater sale.. he even agreed VB black book...
have u ever heard of this book... though contents are good.. but i hope am not missing anything... anyways..
whats the difference betn VB and VB .net or Java or Java.net ...or in short...why and what is this .net
Dipen
__________________
I love walking in Rain ,because no-one knows i am Crying :|
|
|
|
22-08-2005, 02:51 AM
|
#11 (permalink)
|
|
Apprentice
Join Date: Nov 2003
Location: Pune
Posts: 97
|
Mastering VB is good for u
Java.net  ..... no such language....
VB is VB 6.0
VB.net is VB 7.0
.net is microsoft's new platform. any lang that uses it can be said as <language>.net
e.g. ASP.net
|
|
|
22-08-2005, 08:07 AM
|
#12 (permalink)
|
|
Wise Old Owl
Join Date: May 2005
Location: Chennai, India, Asia, the Earth, the Solar system, the Milky Way, the Local group, this Universe.
Posts: 1,171
|
Get the black book coz i think it goes deeper into vb than the others.
Hmmm... .net is a new framework from microsoft. You can imagine a framework to be a collection of APIs. Any language that uses these apis to for programming can be called a .net language.
Basically, .net languages are almost similar in logic (steps taken to accomplish a functionality) but differ in syntax. Since syntax is easily learnt, .net languages look almost the same to a programmer. Also, if u are a vb programmer, u can use vb.net. If for some wierd reason u like vc++, u can use vc++.net. There won't be any perf difference among the .net languages, since they all get compiled into a common lang runtime before execution. So it is flexible and progsrammers need not chose one language once .net platform is to be used.
Hope i primed u in on .net. Check the .net framework books for more.
__________________
http://myxp.blogspot.com
-----------------------
Winchester 3200+ @2,500MHz
LeadTek 7900GT VOLT MODDED @ 680 core, 1800 mem
2x1GB Transcend DDR400 @ DDR454 2.5,3,3,5,1T
|
|
|
22-08-2005, 12:46 PM
|
#13 (permalink)
|
|
Alpha Geek
Join Date: Mar 2004
Location: Pune
Posts: 744
|
Sure... thanx a lot...
u said VC++ a wierd lang... dont we need VC++ anywhere nowadays.. i mean are its substitutes available...
__________________
I love walking in Rain ,because no-one knows i am Crying :|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|