473,511 Members | 12,747 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

2 VB6 Coding Questions

10 New Member
I need to know how to make it so that when you click the commandbutton, text will appear in the OLE white box field thing. I'm new to VB6, so I'm thinking it's a command. I need some good step by step instructions on how to add the code to it or make it work.

Also, what is the code to shutdown a PC?

Thanks for any help, it's greatly appreciated!
May 13 '07 #1
19 1790
Atran
319 Contributor
I need to know how to make it so that when you click the commandbutton, text will appear in the OLE white box field thing. I'm new to VB6, so I'm thinking it's a command. I need some good step by step instructions on how to add the code to it or make it work.

Also, what is the code to shutdown a PC?

Thanks for any help, it's greatly appreciated!
Hello, explain better what you talking about, I do not understand very well, but for Windows Shutting Down Code, Check this site:
http://www.thescripts.com/forum/thread643093.html
May 13 '07 #2
Filter2700
10 New Member
Here, look at this. I want to make it so that when I click the "BUTTON" button text will appear in the OLE white box. I'm trying to make a test program that will allow me to press a button and make the numbers appear in a box.

May 13 '07 #3
Killer42
8,435 Recognized Expert Expert
All I see is a gray square. Could you try attaching the image?

To do so, I think you need to post a message, then within the five-minute time limit, edit the message, and down the bottom of the edit screen, use the button which says "Manage attachments". Then browse to the image, and attach it.
May 13 '07 #4
Filter2700
10 New Member
I don't see any attachments box. I know what you're talking about, but I don't see one.

Just click this link to see the image... http://img379.imageshack.us/img379/43/helppcz9.jpg
May 13 '07 #5
Killer42
8,435 Recognized Expert Expert
I don't see any attachments box. I know what you're talking about, but I don't see one.

Just click this link to see the image... http://img379.imageshack.us/img379/43/helppcz9.jpg
I already tried going to that address before - all I see is a gray square (see first attachment below).

It's possible that a regular member sees different options when editing a message to what a Moderator does, of course. But in theory, when you edit your message you should see "Additional options" below the main edit area. You may have to hit a "+" at the top right of the box expand it. Once you do, you should see something like the second attachment here. If you can get to that point, it should be fairly self-evident how to attach the file.

If the options aren't there, I'll have to have a word to the Admins about why not. Also, I'm at work now so it may be just the system here blocking the image. If so, I should be able to see it when I get home. That's likely to be in about... oh, 3 or 4 hours.

Oops! They seem to be displayed in the reverse order. Oh well, you can see which is which.
Attached Images
 
Attached Images
File Type: jpg Image1.jpg (20.0 KB, 316 views)
May 14 '07 #6
Filter2700
10 New Member
Try this link... http://i41.photobucket.com/albums/e2...2700/helpp.jpg
May 14 '07 #7
Killer42
8,435 Recognized Expert Expert
Try this link... http://i41.photobucket.com/albums/e2...2700/helpp.jpg
Have you actually tried opening any of these links yourself? All I ever see is that gray square I showed in my response. Maybe the image is wrong.
May 14 '07 #8
Killer42
8,435 Recognized Expert Expert
Ok, I finally managed to get a look at the image. So, what exactly is the "OLE white box"? If it's a textbox, then you would just code something like Text1.Text = Button1.Caption in the Click event procedure for the button.

By the way, I notice the controls look a bit different. What is that, Vista?
May 14 '07 #9
Filter2700
10 New Member
All I want is so you click a button, and text that I want will appear, specifically a white text box. I really don't know how to explain it because I'm so new. I'll mess around with that code. Thanks for your help.

And yea, it is vista. It's nice, very nice.
May 14 '07 #10
Filter2700
10 New Member
I entered that code (Text1.Text = Button1.Caption) and I got an error when I tested the program. How do I make the code work? For caption do I put what I want it to say? And where to I place the code, I don't know what the "Click event procedure for the button" is. Please explain more and possibly use some screenshots. I usually need to see it to make sure I know I'm doing it right.

Sorry for the hassle, thanks again.
May 14 '07 #11
Filter2700
10 New Member
Maybe a little help? It's been 2 weeks.
May 22 '07 #12
Killer42
8,435 Recognized Expert Expert
Maybe a little help? It's been 2 weeks.
Sorry, I've been very busy and forgot about this one. Will get to it in a couple of hours now.
May 22 '07 #13
Filter2700
10 New Member
A couple hours turned into a couple days...
May 26 '07 #14
Killer42
8,435 Recognized Expert Expert
A couple hours turned into a couple days...
Bit of an understatement, really - it's about 5 days now.

I'll go back over this thread now, as I've forgotten what it's about.
May 27 '07 #15
Killer42
8,435 Recognized Expert Expert
Bit of an understatement, really - it's about 5 days now.

I'll go back over this thread now, as I've forgotten what it's about.
Ok, the situation is still a little vague. But for the sake of discussion, let's assume that you have a command button called Command1, and a textbox called Text1. That's the default name VB gives them when you create them.

VB is an event-driven language. When the user clicks on the button control, it fires an event procedure called Command1_Click. That's where you would place the code to do something when the button is clicked. (Note that a "click" on the button can also be triggered by the keyboard, but that's not really relevant to this discussion.)

So, let's further assume that when the button is clicked, you want to take the text which is displayed on the button (it's .Caption property) and place it in the textbox. You do this by setting the .Text property of the textbox.

The entire code required to do this would look something like this...

Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2.  
  3. Private Sub Command1_Click()
  4.   Text1.Text = Command1.Caption
  5. End Sub
However, you won't need to enter all of that. You just double-click on the button in the form design window, and it will create the Command1_Click routine - then you simply fill in what to do.

Let me know whether this is what you're after.

However, I'd recommend you have a look on the web for VB tutorials - there are plenty of them around. TheScripts is not really a getting-started site, so much. We're more geared toward helping programmers who run into specific problems in their code.

You might also want to consider downloading a free copy of VB 2005 Express Edition from Microsoft's website. While I love VB6, it is almost 10 years old, so it would seem to make more sense to learn the newer version.
May 27 '07 #16
Filter2700
10 New Member
Thanks for the help, that's exactly what I'm talking about. One more final question, how do I choose what the text will appear like instead of "text". For example, how would I make it appear "hi" in the text box?

Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2.  
  3. Private Sub Command1_Click()
  4.   Text1.Text = Command1.Caption
  5. End Sub
Would I make "Caption" say what I want to appear in the text box?
May 29 '07 #17
Killer42
8,435 Recognized Expert Expert
Thanks for the help, that's exactly what I'm talking about. One more final question, how do I choose what the text will appear like instead of "text". For example, how would I make it appear "hi" in the text box?
Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2.  Private Sub Command1_Click()
  3.   Text1.Text = Command1.Caption
  4. End Sub
Would I make "Caption" say what I want to appear in the text box?
Simply place on the right-hand sifde of the "=" sign whatever you want to assign to the variable or property that's on the left. In other words, replace Command1.Caption with whatever you want to place in the textbox.

You really should play around with the code, and have a look at some beginner VB tutorials. There are plenty of them around on the web.
May 29 '07 #18
Filter2700
10 New Member
Definately, this was a very simple code that I probably could have figured out on my own by messing around and searching. I am going to find some good tutorials. Thanks for the help man, really. I appreciate it, thanks again.
May 29 '07 #19
Killer42
8,435 Recognized Expert Expert
Definately, this was a very simple code that I probably could have figured out on my own by messing around and searching. I am going to find some good tutorials. Thanks for the help man, really. I appreciate it, thanks again.
Glad we could help. But a good tutorial will lead you through the basics (no pun intended) much better than we can do in a few messages here.

Hope we'll see you again as you progress, though. :)
May 29 '07 #20

Sign in to post your reply or Sign up for a free account.

Similar topics

102
7479
by: RFox | last post by:
I date back to the early days of the web when HTML was limited but very managable, and have always maintained that hand-coding HTML gives you far better control and cleaner HTML markup than any...
55
5105
by: Jonas Smithson | last post by:
I've seen a few attractive multi-column sites whose geometry is based on pure CSS-P, but they're what you might call "code afficionado" sites, where the subject matter of the site is "coding...
4
2274
by: dotNetDave | last post by:
About three weeks ago I released the first .NET coding standards book titled "VSDN Tips & Tricks .NET Coding Standards". Here is what the famous author/ speaker Deborah Kurata says about it: ...
1
1260
by: Dgates | last post by:
I'm learning ASP.NET, C# and VB.NET, and hoping to get some feedback from more experienced programmers on a few issues regarding efficient, readable, well-organized code. I'm trying to program...
2
2063
by: Newbie \(C#,Asp.net\) | last post by:
Hi I have two simple questions that I make sure that I have underestood them 1) what is the main difference between inline coding and code behind besides that code behind is part of DLL and is...
60
4971
by: Dave | last post by:
I'm never quite sure whether to use "this." or not when referring to fields or properties in the same class. It obviously works just fine without it but sometimes I wonder if using this....
4
6682
by: AzizMandar | last post by:
C++ Event Coding Questions I have done some simple programs in C++ and read a lot of good C++ books (Including The C++ Programing Language, and C++ Primer) I am trying to understand and...
4
1181
by: Joe Befumo | last post by:
I've been a project manager for the past several years, and my programming chops are a bit rusty, so I'm soliciting help for a programming test for a job. (I don't feel at all dishonest for doing...
8
5835
by: =?Utf-8?B?VGFtbXkgTmVqYWRpYW4=?= | last post by:
I am working with Visual C# window and in my application I need to use a button ( NEXT) . The button should displays one panel with its objects each time it clicked. I already developed the codes...
8
1882
by: wangdaixing | last post by:
I am reading "Programming .NET Components" 2nd Edition by Juval Lowy, O'Reilly. In Appendix E, there is a chapter "Coding Practices" which I agree and practice mostly. However, there are a few...
0
7148
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...
0
7367
Oralloy
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,...
0
7430
jinu1996
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...
0
7517
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5673
agi2029
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,...
1
5072
isladogs
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...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1581
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
451
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.