Forum     

Go Back   Digit Technology Discussion Forum > Portables, Peripherals and Electronics > QnA (read only)
Register FAQ Calendar Mark Forums Read

QnA (read only) Mods please help transfer the contents of this forum to proper sections. :)


 
 
LinkBack Thread Tools Search this Thread Display Modes
Old 19-08-2005, 08:56 PM   #1 (permalink)
Alpha Geek
 
Dipen01's Avatar
 
Join Date: Mar 2004
Location: Pune
Posts: 744
Default 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 :|
Dipen01 is offline  
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 19-08-2005, 10:20 PM   #2 (permalink)
Wise Old Owl
 
siriusb's Avatar
 
Join Date: May 2005
Location: Chennai, India, Asia, the Earth, the Solar system, the Milky Way, the Local group, this Universe.
Posts: 1,171
Default

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
siriusb is offline  
Old 19-08-2005, 10:24 PM   #3 (permalink)
In The Zone
 
bharat_r's Avatar
 
Join Date: Mar 2004
Location: Chennai
Posts: 470
Default

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
bharat_r is offline  
Old 19-08-2005, 10:27 PM   #4 (permalink)
In The Zone
 
bharat_r's Avatar
 
Join Date: Mar 2004
Location: Chennai
Posts: 470
Default

sorry I did not see siriusb's post.
If his methord works ignore mine.
bharat_r is offline  
Old 20-08-2005, 11:36 AM   #5 (permalink)
Alpha Geek
 
Dipen01's Avatar
 
Join Date: Mar 2004
Location: Pune
Posts: 744
Default

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 :|
Dipen01 is offline  
Old 20-08-2005, 02:35 PM   #6 (permalink)
Wise Old Owl
 
siriusb's Avatar
 
Join Date: May 2005
Location: Chennai, India, Asia, the Earth, the Solar system, the Milky Way, the Local group, this Universe.
Posts: 1,171
Default

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
siriusb is offline  
Old 20-08-2005, 03:27 PM   #7 (permalink)
Alpha Geek
 
Dipen01's Avatar
 
Join Date: Mar 2004
Location: Pune
Posts: 744
Default

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 :|
Dipen01 is offline  
Old 20-08-2005, 04:07 PM   #8 (permalink)
Wise Old Owl
 
siriusb's Avatar
 
Join Date: May 2005
Location: Chennai, India, Asia, the Earth, the Solar system, the Milky Way, the Local group, this Universe.
Posts: 1,171
Default

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
siriusb is offline  
Old 21-08-2005, 10:40 PM   #9 (permalink)
Alpha Geek
 
Dipen01's Avatar
 
Join Date: Mar 2004
Location: Pune
Posts: 744
Default

hey buddy...

thanx.. a lot... certainly enlightened....


Dipen
__________________
I love walking in Rain ,because no-one knows i am Crying :|
Dipen01 is offline  
Old 21-08-2005, 10:44 PM   #10 (permalink)
Alpha Geek
 
Dipen01's Avatar
 
Join Date: Mar 2004
Location: Pune
Posts: 744
Default

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 :|
Dipen01 is offline  
Old 22-08-2005, 02:51 AM   #11 (permalink)
Apprentice
 
Join Date: Nov 2003
Location: Pune
Posts: 97
Default

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
nirubhai is offline  
Old 22-08-2005, 08:07 AM   #12 (permalink)
Wise Old Owl
 
siriusb's Avatar
 
Join Date: May 2005
Location: Chennai, India, Asia, the Earth, the Solar system, the Milky Way, the Local group, this Universe.
Posts: 1,171
Default

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
siriusb is offline  
Old 22-08-2005, 12:46 PM   #13 (permalink)
Alpha Geek
 
Dipen01's Avatar
 
Join Date: Mar 2004
Location: Pune
Posts: 744
Default

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 :|
Dipen01 is offline  
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


 
Latest Threads
- by Charan
- by abhidev
- by Sujeet
- by Sarath
- by Krow

Advertisement




All times are GMT +5.5. The time now is 08:44 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2