Question about Computers & Internet

1 Answer

In visual basic how will we change the backcolor of the form randomly when we click the command button?

In this program we want to change the background color of the form by command button when we click on this it will change the bakground color.
everytime when we'll run the program it chose the different color.

Posted by on

  • priya1803 Feb 25, 2009

    I wanted to change the backcolor of a button , rnadomly, it should keep on changing

×

1 Answer

  • Level 2:

    An expert who has achieved level 2 by getting 100 points

    Hot-Shot:

    An expert who has answered 20 questions.

    Corporal:

    An expert that hasĀ over 10 points.

    Mayor:

    An expert whose answer gotĀ voted for 2 times.

  • Expert
  • 53 Answers

Paste this code on you button. This generates a random color.

Red = Int(Rnd * 255)
Green = Int(Rnd * 255)
Blue = Int(Rnd * 255)


Form1.BackColor = RGB(Red, Green, Blue)

Posted on Oct 11, 2008

1 Suggested Answer

6ya6ya
  • 2 Answers

SOURCE: I have freestanding Series 8 dishwasher. Lately during the filling cycle water hammer is occurring. How can this be resolved

Hi,
a 6ya expert can help you resolve that issue over the phone in a minute or two.
best thing about this new service is that you are never placed on hold and get to talk to real repairmen in the US.
the service is completely free and covers almost anything you can think of (from cars to computers, handyman, and even drones).
click here to download the app (for users in the US for now) and get all the help you need.
goodluck!

Posted on Jan 02, 2017

Add Your Answer

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

1 Answer

Private sub cmdEdit_click ( ) what is the right code to work the edit buton


You will probably want to be able to update some value of some field when doing database programming. This is done with Edit and Update. We will try to change the value of the "Phone" field by editing the text in the text box and clicking a button.
Put a command button on the form and name it "cmdUpdate". Then copy the following code to the project.
Private Sub cmdUpdate_Click()

rsMyRS.Edit
rsMyRS!Phone = txtPhone.Text
rsMyRS.Update

End Sub
Could it be that simple? Yes. This changes the phone number of our selected person. Or to put it technically: This changes the value of the "Phone" field of our current record. Imagine the current record being a set of boxes, with a field in each box. T he Edit method takes the lid off all of the boxes and Update puts them back on. When we write rsMyRS!Phone = txtPhone.Text we replace the content of the "Phone" box with the content in the text box.

Dec 16, 2010 | Microsoft Visual Basic 6.0 for PC

1 Answer

How to run vb


How to Run a Visual Basic Program on a PC By an eHow Contributor

Like C++, C Sharp and Java, Visual Basic (VB) is an object oriented programming language. Recently it was integrated to the Microsoft .NET Framework. The .NET Framework is a software infrastructure that speeds up program development. It is supported by the Microsoft Visual Studio Integrated Development Environment (IDE), Microsoft's chief programming environment, and that of SharpDevelop.
Difficulty: Easy Instructions Things You'll Need:

  • Visual Microsoft Studio and .NET Framework
  1. Launch your Microsoft Visual Studio. It is a "heavy" application so depending on how much RAM you have it may take a few minutes to load.
  2. Click the Project tab on the first screen. Notice two buttons at the bottom of the screen named "New Project" and "Open Project." Since the tutorial assumes that this is your first VB program, click the "New Project" button. If you worked on a project before, its name will appear in an area labeled "Open an Existing Project" with a hyperlink that opens the project.
  3. Select "Windows Application" in the "Visual Basic Projects" folder if you intend to run your end program on a computer running a Microsoft Windows operating system. Focus in the "Name" text box near the bottom. Change the name from the default to something more descriptive such as "MyFirstVBProgram." Leave the Location to the default value to save your project to the "My Documents" folder. Press OK.
  4. Concentrate on the grey square area with the arrays of dots. This is the "form." The pinboard shows where components like buttons and text boxes will be installed to make a complete graphic user interface (GUI). The purpose of the grid is to align the components.
  5. Run your program. Click "Debug" from the menu bar. Click "Start" from the drop down menu. Alternatively, you can press F5 on your keyboard.
  6. Enjoy your first Visual Basic program in its simplest form. It is identical to the form in Step 4 except that the dots are gone. What you are looking at is a stand alone program that exists as an ".exe" file having the same name as your project. You can find it under the MyFirstVBProgram folder by default.
  7. Understand the difference between the two distinct environments of the IDE, the Design Environment and the Debug Environment. You saw the Design Environment in Step 4 of this tutorial. That was the environment where you could design a GUI on the form using your mouse. The Debug Environment takes over during the compilation interval in Step 5. That is where you can insert break points in your source code so that you test the correctness of the program.


Read more: How to Run a Visual Basic Program on a PC ' eHow.com http://www.ehow.com/how_2072757_run-visual-basic-program-pc.html#ixzz17b5EMirN

Dec 09, 2010 | Computers & Internet

1 Answer

How to disable command button in visual basic


  • tep 1 Open Visual Basic and select "Standard Exe" to create a new project.
  • Step 2 Add a button by clicking the square button tool on the right, and then clicking and dragging in the main window.
  • Step 3 Click the button once to open the "Properties" window on the right. Select the "(Name)" property, and type "myCmdButton" as the name.
  • Step 4 Double-click the button to open up the code-view window. Type the following in the white space under "Private Sub myCmdButton_Click()":
    myCmdButton.enabled = False;
  • Step 5 Click the blue "Run" button on the top toolbar of Visual Basic. Because you set enabled to "false" in the previous step, you will see your button grayed out, and nothing will happen when you click it.
  • Jul 07, 2010 | Microsoft Computers & Internet

    1 Answer

    Step by step instructions on how to create a macro, create form f


    You can create a macro by using the macro recorder to record a sequence of actions, or you can create a macro from scratch by entering Visual Basic for Applications code in the Visual Basic Editor.
    Open a new document.
    From the Tools menu, choose Customize.
    Click the Commands tab and then scroll down in the Categories box and select Macros. You’ll see the names of any macros you've created in the Commands box on the right-hand side.
    Click, hold, and drag your macro onto any toolbar and release, as shown in Figure D. A button with the name of the macro will appear on the toolbar.

    May 25, 2010 | Microsoft Office Word 2007 Full Version...

    1 Answer

    How to change the background color of cells in datagridview in VB 6.0


    Use the "Style" property 
    DataGridView1.Item(ColumnIndex, RowIndex).Style.BackColor = Color
    DataGridView1.Item(ColumnIndex, RowIndex).Style.ForeColor = Color
    or
    DataGridView1.CurrentCell.Style.BackColor = Color
    DataGridView1.CurrentCell.Style.ForeColor = Color

    This is how you change the backround color. 

    Feb 06, 2010 | Microsoft Visual Basic Enterprise Edition...

    1 Answer

    Visaul basic coding for changing colour of buttons


    Just click on button and change the property of backcolor or picture

    Ok...........
    My Name is Maulik Chauhan

    And Your Self

    My Orkut id is maulik.chauhan99@gmail.com

    Jul 10, 2009 | Microsoft Visual Basic Enterprise Edition...

    1 Answer

    Accept x and y from user and calculate x raise to y


    here is the solution;
    solution 1 (need 3 text boxes, Namely text1, text2 & text3 & a command button. Put the code below in the button click event) Dim x, y As Integer x = Text1 y = Text2 Text3 = x ^ y
    solution 2 (put the code either in form load event or button click event)
    Dim X, Y As Integer X = InputBox("Enter X", "X ? ") Y = InputBox("Enter Y", "Y ? ") MsgBox "X^Y = " & X ^ Y

    May 18, 2009 | Polar Electro Wearlink Coded Watch

    1 Answer

    I want to open a jpg and doc file through command button in vb6


    try to convert it to vb6 file and open it via vb6.... heres the link >>>> http://3d2f.com/tags/vb6/converter/registered/software/

    Feb 28, 2009 | Microsoft Visual Basic 6.0 for PC

    1 Answer

    Visual Basic


    Hi Buddy,

    Create 2 buttons for previous and next in a form(say, current_form). take the previous form as 'prev_form' and next form as 'next_form' then
    write a code in the previous button command click event as

    prev_form.Show()
    current_form.Hide()

    write a code in the next button command click event as
    next_form.Show()
    current_form.Hide()

    Please let me know if you have any concerns

    Sep 02, 2008 | Computers & Internet

    2 Answers

    How i can change forms backcolor through coding in vb.net


    ok you have 3 choices
    assuming your form name is main.

    main.backcolor = color.blue
    or
    this.backcolor = color.blue
    or
    me.backcolor = color.blue

    you can type your form name followed by the . to get all options for changing it peoperties,
    or you can type this. refering to the form your are currently in, this has the effect just as the form name,
    If you are programming on the formitself you can use
    me. same effect as the form name..

    Jan 18, 2008 | Computers & Internet

    Not finding what you are looking for?
    Computers & Internet Logo

    Related Topics:

    142 people viewed this question

    Ask a Question

    Usually answered in minutes!

    Top Computers & Internet Experts

    Les Dickinson
    Les Dickinson

    Level 3 Expert

    18384 Answers

    kakima

    Level 3 Expert

    102366 Answers

    David Payne
    David Payne

    Level 3 Expert

    14161 Answers

    Are you a Computer and Internet Expert? Answer questions, earn points and help others

    Answer questions

    Manuals & User Guides

    Loading...