Page 1 of 1

Common Dialog Control (VB6) What it is, example of using it Rate Topic: -----

#1 benpap  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 6
  • View blog
  • Posts: 47
  • Joined: 24-November 07

Post icon  Posted 18 December 2007 - 01:23 PM

*
POPULAR

Hello there, in this tutorial we will be discussing the common dialog control.

I'll first explain what this is.

Common dialog control is a component that allows us to access inbuilt libraries.
If you don't know what these are let me explain it to you with an example.

Open the notepad go to File and click Save As... A window will pop up with a couple
of components (command buttons, combo boxes, etc). You will face other programmes having
the same kind of window with these components. If you have TextPad, an editor that comes
in handy for programmers, you will see the same.

The reason why to use common dialog controls is that you won't need to spend time making
your custom libraries, just use the inbuilt ones, but it's up to you.

Lets get started!

We will now built a small application that changes the colour of a picture box

Open a new project, select Standart.exe. Right click on the tools list, go to components,
find and select Microsoft Common Dialog Control (6.0 in my case). Add a picture box name
it to "picbox" and also change the AutoRedraw to true. Then add a command button, name it
"cmdsetcol". In the end add a common dialog control and name it "cmdlg".

Now we'll go to the coding.

Use the following code for the command button:
cmdlg.ShowColor
picbox.BackColor = cmdlg.Color



Now by pressing the button an inbuilt library of colour selection will pop up. You might
have come across it in several painting applications and several times colour changing
is involved. After selecting a colour and proceeding to our form the pictures box colour
will automatically change to the colour we selected due to the second line of code.
Its very easy!

Let us add a text box and another two command buttons and add the following code the them:
Private Sub Command1_Click()
cmdlg.ShowColor
Text1.ForeColor = cmdlg.Color
End Sub

Private Sub Command2_Click()
 cmdlg.ShowColor
 Text1.BackColor = cmdlg.Color
End Sub



Now we can change the back and character colour of the text box.

Hope you understood it all briefly and i wish you learning and coding!

Is This A Good Question/Topic? 5
  • +

Replies To: Common Dialog Control (VB6)

#2 Gin13lind  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 09-January 08

Posted 15 February 2008 - 06:53 AM

NC man tnx. simple but great help... :D coz Im trying 2 imitate paint application.. :^: :^: :^:
Was This Post Helpful? 0
  • +
  • -

#3 Guest_Dinesh Dwivedi*


Reputation:

Posted 27 February 2010 - 02:20 AM

The information was really helpful..

Thanks
Was This Post Helpful? 0

#4 darkvai  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 7
  • Joined: 23-March 10

Posted 25 March 2010 - 02:41 AM

This is a good tutorial though You could add another tutorial of Saving and other things...

:basecase:
:rockon:
Was This Post Helpful? 0
  • +
  • -

#5 Guest_Piyush*


Reputation:

Posted 09 April 2010 - 03:23 AM

thanxxxxxxxxxx buddy.... :) :angel: :bananaman:
Was This Post Helpful? 0

#6 kr0nuz.pl46u3  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 06-June 10

Posted 06 June 2010 - 07:04 AM

Thank you for your information sir. :smile2:
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1