Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 8th, 2003, 02:11 PM
intelchip intelchip is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: india
Posts: 69 intelchip User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Send a message via Yahoo to intelchip
command button problem

hi i am very beginner... i started vb just...i created a command button. and then changed its name(caption) to cmdRoy. then i double clicked on that and got the coding window. there i wrote
simply

Private Sub Command2_Click()
cmdRoy.Caption = " Click "
End Sub

then i run this program......but getting error " object required...
run time error '424' ....i dont understand this error. how can i fix it.

i am studying the tutorial from this site

http://www.developer.com/net/vb/art...10926_1538771_4


i want to ask one more question..
i found use of uppercase and lowercase letters in the variable. is there any rule / syntax for that???

e.g frmTest.BackColor = vbGreen

capital and small letter mixed!!!!!!.... how to remember this???

thanks
__________________
intelchip

Reply With Quote
  #2  
Old December 8th, 2003, 02:48 PM
Fisherman's Avatar
Fisherman Fisherman is offline
Inherits Programmer.Slacker
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Location: Between my Id and your Ego
Posts: 2,178 Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 56 m 45 sec
Reputation Power: 111
Send a message via ICQ to Fisherman Send a message via AIM to Fisherman
OK.. to clarify a few points for you, the caption property of a command button or any other control on a form has nothing to do with the identification of that control, for that, you have to change the (Name) property at the top of the form. If you'll look at your sub-procedure heading, you'll notice that it's still called Command2_Click - this is because the name of your button is Command2. You are getting the error because you are trying to call the caption method of a button that doesn't exist (there is no button on your form called cmdRoy) To rectify this situation, change either the name of the command button in the properties window to cmdRoy, or change the reference in your procedure to Command2.

Second - case doesn't matter in VB. VB's intellisense takes care of case issues. It is not as picky as other OO languages like C++ and JAVA. You can test this by typing in the following declarations in a subprocedure in your program.
Code:
'type exactly as you see it here.
dim InTcOuNtEr as integer

'type this in all lowercase
intcounter=0

You should notice that when you hit enter after the intcounter=0 that the case will change to that of the variable declaration.

Good Luck
__________________
Fisherman

"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." - A.Einstein

Reply With Quote
  #3  
Old December 8th, 2003, 05:41 PM
Fisherman's Avatar
Fisherman Fisherman is offline
Inherits Programmer.Slacker
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Location: Between my Id and your Ego
Posts: 2,178 Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 56 m 45 sec
Reputation Power: 111
Send a message via ICQ to Fisherman Send a message via AIM to Fisherman
as a side note - it is often considered to be good practice to dimension your variables with mixed case, such as
Code:
dim intMyInteger as integer


This gives you a way to check your variable declarations as your typing - since after you type "intmyinteger" in lowercase and hit <ENTER>, VB6 will change it to the proper case of the variable declaration.

Reply With Quote
  #4  
Old December 9th, 2003, 07:07 AM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via MSN to cleverpig
Hi,intelchip!It's a obvious mistake!
cmdboy doesn't exist in your form!It cause the error you get!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > command button problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT