Results 1 to 23 of 23

Thread: [RESOLVED] Visual Basic beginner.

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2006
    Location
    New Zealand
    Posts
    3

    Resolved [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

  2. #2
    Lively Member
    Join Date
    Jul 2006
    Location
    Brunei
    Posts
    111

    Re: Visual Basic beginner.

    erm, why not use VB 6?

  3. #3
    Hyperactive Member Datacide's Avatar
    Join Date
    Jun 2005
    Posts
    309

    Re: Visual Basic beginner.

    Or the latest version, 2005. Especially since it's free...
    PHP in your FACE!

  4. #4
    PowerPoster Keithuk's Avatar
    Join Date
    Jan 2004
    Location
    Staffordshire, England
    Posts
    2,238

    Re: Visual Basic beginner.

    It should change colour irrespective of the version of VB.
    VB Code:
    1. Private Sub Form_Load()
    2.  
    3. Text1.ForeColor = vbRed
    4. Text1.BackColor = vbBlue
    5. Text1.Text = "Test colour"
    6.  
    7. 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.

  5. #5
    VB Guru ganeshmoorthy's Avatar
    Join Date
    Dec 2005
    Location
    Sharjah, United Arab Emirates
    Posts
    3,031

    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.


  6. #6
    Fanatic Member r0ach's Avatar
    Join Date
    Dec 1999
    Location
    South Africa
    Posts
    722

    Re: Visual Basic beginner.

    Quote 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

  7. #7
    Junior Member
    Join Date
    Jul 2006
    Posts
    19

    Re: Visual Basic beginner.

    Quote Originally Posted by Datacide
    Or the latest version, 2005. Especially since it's free...


    Free?????

  8. #8
    Fanatic Member r0ach's Avatar
    Join Date
    Dec 1999
    Location
    South Africa
    Posts
    722

    Re: Visual Basic beginner.

    Express is free. 2005 is NOT free.

    r0achâ„¢
    Don't forget to rate the post

  9. #9
    Junior Member
    Join Date
    Jul 2006
    Posts
    19

    Re: Visual Basic beginner.

    express???

  10. #10
    Fanatic Member r0ach's Avatar
    Join Date
    Dec 1999
    Location
    South Africa
    Posts
    722

    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

  11. #11
    Fanatic Member r0ach's Avatar
    Join Date
    Dec 1999
    Location
    South Africa
    Posts
    722

    Re: Visual Basic beginner.


    r0achâ„¢
    Don't forget to rate the post

  12. #12
    Junior Member
    Join Date
    Jul 2006
    Posts
    19

    Talking Re: Visual Basic beginner.

    Quote 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

  13. #13
    Fanatic Member r0ach's Avatar
    Join Date
    Dec 1999
    Location
    South Africa
    Posts
    722

    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

  14. #14
    Hyperactive Member
    Join Date
    Aug 2002
    Location
    UK
    Posts
    417

    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.

  15. #15
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Visual Basic beginner.

    The EE's are now free for life.

  16. #16

    Thread Starter
    New Member
    Join Date
    Jul 2006
    Location
    New Zealand
    Posts
    3

    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...

  17. #17
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Re: Visual Basic beginner.

    Quote Originally Posted by penagate
    The EE's are now free for life.
    What is EE?
    CS

  18. #18
    Hyperactive Member Datacide's Avatar
    Join Date
    Jun 2005
    Posts
    309

    Re: Visual Basic beginner.

    Quote Originally Posted by cssriraman
    What is EE?
    Express Editions
    PHP in your FACE!

  19. #19
    Fanatic Member r0ach's Avatar
    Join Date
    Dec 1999
    Location
    South Africa
    Posts
    722

    Re: Visual Basic beginner.

    Quote 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.

    Quote 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

  20. #20

    Thread Starter
    New Member
    Join Date
    Jul 2006
    Location
    New Zealand
    Posts
    3

    Thumbs up 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...

  21. #21
    Fanatic Member r0ach's Avatar
    Join Date
    Dec 1999
    Location
    South Africa
    Posts
    722

    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

  22. #22
    PowerPoster Keithuk's Avatar
    Join Date
    Jan 2004
    Location
    Staffordshire, England
    Posts
    2,238

    Re: [RESOLVED] Visual Basic beginner.

    Quote 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:
    1. Private Sub Form_Load()
    2.  
    3. Text1.ForeColor = vbRed
    4. Text1.BackColor = vbBlue
    5. Text1.Text = "Test colour"
    6.  
    7. 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:
    1. Private Sub Command1_Click()
    2.  
    3. CommonDialog1.ShowColor 'opens the colour dialog box
    4. Text1.ForeColor = CommonDialog1.Color
    5.  
    6. End Sub
    7.  
    8. Private Sub Command2_Click()
    9.  
    10. CommonDialog1.ShowColor 'opens the colour dialog box
    11. Text1.BackColor = CommonDialog1.Color
    12.  
    13. 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.

  23. #23
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: [RESOLVED] Visual Basic beginner.

    Quote 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
  •  



Click Here to Expand Forum to Full Width