I am not an experienced programmer. I am getting an error as "method or data member not found" when i entered the following code in buttonclick procedure of the toolbar. - select case button.key
-
case "btn1"
-
msgbox ""
-
case "btn2"
-
msgbox ""
-
end
-
end select
Can anybody help me in figuring out this problem
Thanks
22 7134
I am not an experienced programmer. I am getting an error as "method or data member not found" when i entered the following code in buttonclick procedure of the toolbar.
select case button.key
case "btn1"
msgbox ""
case "btn2"
msgbox ""
end
end select
Can anybody help me in figuring out this problem
Thanks
Kay, your Case statement is not setup correctly: remove the line "end". Also, I think that it does not like button.key. What did you Dim button as? What version of VB are you using: VBA, VB6, or VB.NET?
Kay, your Case statement is not setup correctly: remove the line "end". Also, I think that it does not like button.key. What did you Dim button as? What version of VB are you using: VBA, VB6, or VB.NET?
I declared button as Integer, also I removed the end statement. Still I am getting the same error. I am using vb98.
>I removed the end statement
Great!
>I am using vb98
Why? We can give you general ideas, but I and most others have never seen vb98
>I declared button as Integer
then you cannot have button.key
so what does button equal at the top of your code. Can't you just do - Select Case button
-
Case 1
-
MsgBox("First")
-
Case 2
-
MsgBox("Second")
-
Case Else
-
MsgBox("Something else")
-
End Select
I am using vb6.0 version. I tried by removing ".key" as you told. This is not showing anything.
I am using vb6.0 version. I tried by removing ".key" as you told. This is not showing anything.
Ah, VB6, where is the wipes off the sweat smilie.
You are correct, it should be Button.Key. So, - Make sure that you added buttons to the ToolBar
- Make sure that you entered the keys for the buttons: btn1, btn2
Now, you event routine should look like: - Option Explicit
-
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
-
Select Case Button.Key
-
Case "btn1"
-
MsgBox "First"
-
Case "btn2"
-
MsgBox "Second"
-
End Select
-
End Sub
I have been trying this from yesterday. I kept the .key as btn1 and btn2 correctly.
getting the same compilation error by highlighting ".key" method in blue color.
I am sorry to tell like this.
I have been trying this from yesterday. I kept the .key as btn1 and btn2 correctly.
getting the same compilation error by highlighting ".key" method in blue color.
I am sorry to tell like this.
Don't be sorry, this is why we get the big bucks! ;) In #3, you said "I declared button as Integer". VB defines it as MSComctlLib.Button. Does your code look exactly like mine?
Yes, have been trying the code which is exactly like yours. But as you asked me about the declaration, then I thought "ok, I need to declare" like that.
So I tried both ways. I think my code doesn't like .key method.(but why I don't know)
Yes, have been trying the code which is exactly like yours. But as you asked me about the declaration, then I thought "ok, I need to declare" like that.
So I tried both ways. I think my code doesn't like .key method.(but why I don't know)
I would suggest that you start all over again, slowly. Follow these steps: - Get out of all windows but this one and start VB6 from the Start button
- In the New Project dialog, select Standard EXE and press Open
- If you don't have a Toolbar control in the toolbox, press Ctrl T and place a checkmark before Microsoft Windows Common Controls 6.0
- Double-click the toolbar icon in the toolbox to add it to your form
- Click on Custom in the Properties window and press the elipses button.
- Click on the Buttons tab and click Insert Button.
- Make the caption 1 and the key btn1
- Click Insert Button again
- Make the caption 2 and the key btn2 and press OK
- Double-click on the toolbar to bring up the code window
- Add code to the Click event
- Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
-
Select Case Button.Key
-
Case "btn1"
-
MsgBox "First"
-
Case "btn2"
-
MsgBox "Second"
-
End Select
-
End Sub
Now, press the Start button and see if the buttons work.
I could be wrong, but I think that the Member .key has to belong to the class Button... Hope this helps, Roger
I followed the steps,got the same error.But when i double clicked the toolbar from the toolbox(as in step 4), I got toolbar wizard along with toolbar.Does this makes any difference ?? Waiting for your reply !!!!
That might be the reason, How do I check that ?
I opened Object Browser, selected "button" option in left pane, nothing is shown in the right pane.
If that is your guess, can you please show how to include the ".key" method to my project.
I followed the steps,got the same error.But when i double clicked the toolbar from the toolbox(as in step 4), I got toolbar wizard along with toolbar.Does this makes any difference ?? Waiting for your reply !!!!
What is a toolbar wizard? We are not using the same VB6. Remove your toolbar and press Ctrl T to open the Components dialog. Uncheck everything on the Controls tab and press OK. Now, press Ctrl T again and place a checkmark before Microsoft Windows Common Controls 6.0.
Now, try adding the Toolbar again. If you get a wizard, some other VB6 guru will have to help you because I don't do wizards, daemons, or databases. :D Hope this solves it! --Sam
How do I check whether all the required members of button are present in my project ??
How do I check whether all the required members of button are present in my project ??
:confused: Since you are using a non-standard toolbar, we have no way of knowing. Please do what my last post said.
Thank you for your help.That is the reason. But how can I include the members to the button ?
I looked for the methods of button object in Object Browser, then compared with other system's Button Object. So I found that my system has no methods for button object. Is it possible to add the methods to my system too ? Can you please check it Thank you very much for your help
I think in object oriented programming such as Visual Basic .Net you can add your own custom methods to the Button Class. That is all I remember... Roger
I am not an experienced programmer. I am getting an error as "method or data member not found" when i entered the following code in buttonclick procedure of the toolbar. - select case button.key
-
case "btn1"
-
msgbox ""
-
case "btn2"
-
msgbox ""
-
end
-
end select
Can anybody help me in figuring out this problem
Sorry, I haven't followed the rest of the thread yet (short of time) but if you have defined button as anything, that is probably your problem. If this is the type of toolbar I'm familiar with, Button should represent the parameter ( ByVal Button As MSComctlLib.Button) which is received when this event procedure is called.
Oops! Looks as though I spoke too soon.
Are you sure you don't have some custom object you're created (or a form or whatever) called "Button"?
Here's an exercise which might (or might not) help. Change the name of the parameter to something which you know won't match anything else. For example... - Private Sub Toolbar1_ButtonClick(ByVal KillerSaidToDoThis As MSComctlLib.Button)
-
Debug.Print KillerSaidToDoThis.Index, KillerSaidToDoThis.Caption, _
-
KillerSaidToDoThis.Key
-
End Sub
I believe that we are reaching the end of how much help we can provide here. Clear step by step instructions have been given.
We all started somewhere and there is no shame in being a newbie. My suggestion is find a book or course and learn the basics. This is a site for programmers and not geared to learning the basics - it is assumed by the experts that you have this.
So please learn the fundamentals, it will save you time in the log run. I am sure we could suggest some resources if you like. Thanks.
I looked for the methods of button object in Object Browser, then compared with other system's Button Object. So I found that my system has no methods for button object.
When you select Button in the object browser, what does it show in the grey window down the bottom?
(Note, I've updated the title of the thread - "Hi All" won't help anyone in the future who needs to search for help on this topic).
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Poseidon |
last post by:
I use "read" method to read some blocks into a buffer from a filestream, and send data in the buffer to remote server with "send" method of cocket class. For certain computers, I have to add "sleep"...
|
by: 21novembre |
last post by:
Hi all,
I made a question several days before to describe my strange trouble of
mysqldump. But I still can't figour it out. Well, I just want to ask
another question whether I could just backup...
|
by: Tom S |
last post by:
I'm using ASP.NET with C# as my code behind and I figure out how to get the
above process to work. I've found many examples online for using the
'method' member to "POST", but none for setting it...
|
by: martyn_wynne |
last post by:
Hi,
I have found a odd one, my submit button is not submitting on a
method="get" form after using any form of DataBind?
Has anyone struck this problem before?
here is snipits of the code as...
|
by: Owen |
last post by:
Hello everyone,
I am using VS.NET 2003(Trandition Chinese) Edition, and httpLook
software for checking http requests. I found a problem that the
following programs don't really "POST". These...
|
by: Jerry Boone |
last post by:
I did a lot of searching and found many who said this couldn't be done.
After searching I didn't "seem" to turn up anyone who provides this
solution. If you posted or found something on this...
|
by: James MA |
last post by:
I'm now writing a small program to communicate a web server to simulate a web
client. I use te httpwebrequest to talk with the server, and it works find
for "POST" method, however, when i test...
|
by: johkar |
last post by:
Why does if(win==null || win.closed) return true after one PDF is open.
Something very wierd going on with IE 6. I also get a member not
found error if a child window is already open. This script...
|
by: sofeng |
last post by:
I'm not sure if "data hiding" is the correct term, but I'm trying to
emulate this object-oriented technique. I know C++ probably provides
much more than my example, but I'd just like some feedback...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |