-
Jul 12th, 2006, 12:53 AM
#1
Thread Starter
New Member
[RESOLVED] Visual Basic beginner.
Win XP Home SP.2 - VB 4 Pro.
Just starting to learn VB and have a problem with foreground color in a text box. When viewing the form the text is white (the background color sets ok) but regardless of which forecolor I select in Properties the color does not change. When the prog is Run the forecolor changes to something like a buff color. The color hex number in the forecolor selection box remains as it was set by me.
Am following the Sams Publishing Teach Yourself publication and have some, but not a lot of, pc knowledge.
What am I doing wrong please
-
Jul 12th, 2006, 12:57 AM
#2
Lively Member
Re: Visual Basic beginner.
-
Jul 12th, 2006, 01:12 AM
#3
Hyperactive Member
Re: Visual Basic beginner.
Or the latest version, 2005. Especially since it's free...
-
Jul 12th, 2006, 06:42 AM
#4
Re: Visual Basic beginner.
It should change colour irrespective of the version of VB.
VB Code:
Private Sub Form_Load()
Text1.ForeColor = vbRed
Text1.BackColor = vbBlue
Text1.Text = "Test colour"
End Sub
You could add a CommonDialog control and change the ForeColor and BackColor with the CommonDialog.Color.
Last edited by Keithuk; Jul 12th, 2006 at 06:45 AM.
Keith
I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
-
Jul 12th, 2006, 06:47 AM
#5
Re: Visual Basic beginner.
or even you can use RGB function, which is also supported by all the versions of vb...
If an answer to your question has been helpful, then please, Rate it!
Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.
-
Jul 12th, 2006, 07:21 AM
#6
Fanatic Member
Re: Visual Basic beginner.
Originally Posted by Hedonist1
When the prog is Run the forecolor changes to something like a buff color.
What do you mean by "buff color"? It could be that the textbox's enabled = false. set it to true.
r0achâ„¢
Don't forget to rate the post
-
Jul 12th, 2006, 07:26 AM
#7
Junior Member
Re: Visual Basic beginner.
Originally Posted by Datacide
Or the latest version, 2005. Especially since it's free...
Free?????
-
Jul 12th, 2006, 07:38 AM
#8
Fanatic Member
Re: Visual Basic beginner.
Express is free. 2005 is NOT free.
r0achâ„¢
Don't forget to rate the post
-
Jul 12th, 2006, 07:40 AM
#9
Junior Member
Re: Visual Basic beginner.
-
Jul 12th, 2006, 07:41 AM
#10
Fanatic Member
Re: Visual Basic beginner.
VB Express, C# Express, VWB Express. All .NET 2 IDE's called "Express" are free. They're mini versions of 2005. And Freeeee!!!!! SQL Express is free, too. And you can distribute the DB's freely with your apps!
r0achâ„¢
Don't forget to rate the post
-
Jul 12th, 2006, 07:43 AM
#11
Fanatic Member
Re: Visual Basic beginner.
r0achâ„¢
Don't forget to rate the post
-
Jul 12th, 2006, 07:49 AM
#12
Junior Member
Re: Visual Basic beginner.
Originally Posted by r0ach
VB Express, C# Express, VWB Express. All .NET 2 IDE's called "Express" are free. They're mini versions of 2005. And Freeeee!!!!! SQL Express is free, too. And you can distribute the DB's freely with your apps!
??????????????????????
lol
-
Jul 12th, 2006, 08:06 AM
#13
Fanatic Member
Re: Visual Basic beginner.
OK, this is the last time I'm saying this (and I don't know what the ????????????????????? is for...).
VB 2005 Express (and all the other programs in Visual Studio 2005 Express) are free. This means that you do not have to buy it. You can have it. It's yours. All you have to do is follow the link above and download it.
Hedonist1, has your problem been resolved?
r0achâ„¢
Don't forget to rate the post
-
Jul 12th, 2006, 09:48 AM
#14
Hyperactive Member
Re: Visual Basic beginner.
Incase you need a full IDE for .NET 1.1 or .NET 2.x I use this http://www.icsharpcode.net/OpenSource/SD/ Nise IDE and is free,
I used the express versions my self and as someone already stated there only mini versions, I am not sure but I also herd that they also expire after a year.
Sharp Develop has support for VB.NET, C# and many more.
When your dreams come true.
On error resume pulling hair out.
-
Jul 12th, 2006, 09:49 AM
#15
Re: Visual Basic beginner.
The EE's are now free for life.
-
Jul 12th, 2006, 06:02 PM
#16
Thread Starter
New Member
Re: Visual Basic beginner.
Thank you all for responding.
At my level of knowledge some of the advice given will need considerable investigation in order for me to understand the recommendations. If this forum covered skiing I would be on the nursery slopes.
Kaine - Why VB.4 - it was gifted to me by a colleague who simply gave up trying to understand it. It came with all manuals, COA etc...
Datacide - Will try the 2005 version if I can't get VB.4 to perform.
Keithuk - I also believe the first line of your response. The rest I simply don't understand yet - my knowledge level is extremely low.
Ganeshmoorthy - Ditto re my knowledge level.
R0ach - When viewing the form the backcolor is red and the forecolor is white. When I change the forecolor using the forecolor setting in the textbox properties the forecolor in the textbox does not change. When Run the forecolor changes to what I describe as a buff color, i.e. it does not retain its white. Changing Enabled to True has no effect.
This is day 10 of my trials and tribulations and I'm not yet past Day 2 of the Sams course I will redo the entire program to see if I have entered or coded something which has caused a conflict, then review the recommendations given in your responses.
Thank you all very much for your input.
H...
-
Jul 12th, 2006, 08:42 PM
#17
Re: Visual Basic beginner.
Originally Posted by penagate
The EE's are now free for life.
What is EE?
-
Jul 13th, 2006, 02:23 AM
#18
Hyperactive Member
Re: Visual Basic beginner.
Originally Posted by cssriraman
What is EE?
Express Editions
-
Jul 13th, 2006, 03:06 AM
#19
Fanatic Member
Re: Visual Basic beginner.
Originally Posted by dreamvb
I used the express versions my self and as someone already stated there only mini versions, I am not sure but I also herd that they also expire after a year.
The Express Editions doesn't expire. They never have. The free offer was set to expire in November 2006. After that you would have had to pay if you want it. If you already had it, it's your's for free.
Yes, it is a mini-version. 90% of the templates have been removed. Boo-hoo! The only restriction I found with express was that I didn't have a template to make add-ins. Express has the ability, but not the template. So, you'll need to know where to register what and what to implement. Otherwise, I'd describe Express as: Visual Studio 2005 without templates.
Originally Posted by Hedonist1
R0ach - When viewing the form the backcolor is red and the forecolor is white. When I change the forecolor using the forecolor setting in the textbox properties the forecolor in the textbox does not change. When Run the forecolor changes to what I describe as a buff color, i.e. it does not retain its white. Changing Enabled to True has no effect.
Could I ask that you zip the project and post it?
r0achâ„¢
Don't forget to rate the post
-
Jul 13th, 2006, 05:17 AM
#20
Thread Starter
New Member
Re: [RESOLVED] Visual Basic beginner.
R0ach - thanks for staying with me.
I confess to having been trying to alter the TextBox while viewing the Form properties. Getting that right and applying your fix by making Enabled=True resolved the problem altho' the Sams properties table instructions do not mention Enabled. They do, however, mention making Multiline=True but making that False changes nothing. Perhaps a little bit of confusion there as well as my own.
Thanks again
H...
-
Jul 13th, 2006, 05:25 AM
#21
Fanatic Member
Re: [RESOLVED] Visual Basic beginner.
I thought so, but wasn't sure. Wanted to check the actual project.
r0achâ„¢
Don't forget to rate the post
-
Jul 13th, 2006, 06:39 AM
#22
Re: [RESOLVED] Visual Basic beginner.
Originally Posted by Hedonist1
Thank you all for responding.
Keithuk - I also believe the first line of your response. The rest I simply don't understand yet - my knowledge level is extremely low.
Just put a TextBox on a Form and leave the control name Text1. Copy and paste the code below into the Form_Load section of the code window. Or just double-click on a blank area of the Form, this will open at the Form_Load of the code window. This will show you if you can change the TextBox colours.
VB Code:
Private Sub Form_Load()
Text1.ForeColor = vbRed
Text1.BackColor = vbBlue
Text1.Text = "Test colour"
End Sub
As for using a CommonDialog control for choosing colours. Right-click on a blank area of the Toolbox and select Components or press Ctrl+T. Look down the list untill you find Microsoft CommonDialog and put a tick in the checkbox then apply. This will put the CommonDialog icon in your Toolbox. Have you Form showing and click on the CommonDialog icon then draw it on your Form.
Put 2 Command buttons on you Form using the same method as CommonDialog. All controls should have a suitable control name but just for this demo you can leave as Command1 and Command2.
VB Code:
Private Sub Command1_Click()
CommonDialog1.ShowColor 'opens the colour dialog box
Text1.ForeColor = CommonDialog1.Color
End Sub
Private Sub Command2_Click()
CommonDialog1.ShowColor 'opens the colour dialog box
Text1.BackColor = CommonDialog1.Color
End Sub
There are other code you can add the a CommonDialog but this simple example should work. Just double-click on each Command button and copy and paste the above code in each one.
Keith
I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
-
Jul 13th, 2006, 10:48 AM
#23
Re: [RESOLVED] Visual Basic beginner.
Originally Posted by Hedonist1
I confess to having been trying to alter the TextBox while viewing the Form properties. Getting that right and applying your fix by making Enabled=True resolved the problem altho' the Sams properties table instructions do not mention Enabled.
It's enabled by default. If yours was disabled (Enabled = False) you changed it.
They do, however, mention making Multiline=True but making that False changes nothing.
It will if you put more than 1 line of text into the box:
Text1.Text = "Line 1" & vbnewline & "Line 2"
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|