Upload
amandeep-kaur
View
1.157
Download
1
Tags:
Embed Size (px)
DESCRIPTION
Citation preview
Presentation OnTopic: Timer, ComboBox,Rich TextBox, Slider
Contents
Timer Contol ComboboxRich TextboxSlider
Timer Control
Timer Control Works like a stopwatch or alarm clockTimer control counts repeatedly as long as enabled
property is set to trueInterval: It specifies the interval between Timer events
in milliseconds
Timer Control Application
Coding
Dim counter As Integer Private Sub cmdend_Click() Timer1.Enabled = False End Sub
Private Sub cmdstart_Click() Timer1.Enabled = True End Sub
Private Sub Timer1_Timer() counter = counter + 1 If counter = 95 Then counter = 1 End If If counter = 1 Then Shape1.FillColor = vbRed Shape2.FillColor = vbWhite Shape3.FillColor = vbWhite End If
If counter = 45 Then Shape1.FillColor = vbWhite Shape2.FillColor = vbYellow Shape3.FillColor = vbWhite End If If counter = 50 Then Shape1.FillColor = vbWhite Shape2.FillColor = vbWhite Shape3.FillColor = vbGreen End If End Sub
Output
Combo Box Control
Features of Text box and List box It is used to present list to the UserThis control allow the user to select an item either by
typing into the Combo box, or by selecting it from the list It contains an edit field
Combo Box Styles
Three Styles Combo Box The drop down combo Box The Simple combo Box The drop down list
Drop Down List BoxStyle 2
Drop down Combo BoxStyle 0
Simple Combo BoxStyle 1
Form Design
Combo Box Application
Coding Dim a, b Private Sub cmdshowdate_Click() lblcombo.Caption = Combo2.Text + " " + Combo3.Text + "," + Combo4.Text End Sub
Private Sub Combo1_click() If Combo1.ListIndex = 0 Then lblcombo.ForeColor = vbRed End If If Combo1.ListIndex = 1 Then lblcombo.ForeColor = vbGreen End If If Combo1.ListIndex = 2 Then lblcombo.ForeColor = vbBlue End If End Sub
Conti…
Private Sub Form_Load() Combo1.AddItem "Red" Combo1.AddItem "Green" Combo1.AddItem "Blue" a = 0 Do While a < 31 a = a + 1 Combo3.AddItem a Loop
b = 1900 Do While b < 2012 b = b + 1 Combo4.AddItem b Loop
Conti…
Combo2.AddItem "Jan" Combo2.AddItem "Feb" Combo2.AddItem "March" Combo2.AddItem "April" Combo2.AddItem "May" Combo2.AddItem "June" Combo2.AddItem "july" Combo2.AddItem "August" Combo2.AddItem "September" Combo2.AddItem "October" Combo2.AddItem "November" Combo2.AddItem "December" End Sub
Output
Rich Text Box
The Rich Text Box Control allows the user to enter and edit text while also providing more advanced formatting features than the conventional TextBox control.
Syntax:
RichTextBox
How to Open Rich Text Box
Form Design
Conti…
Private Sub cmdrtbbox_Click() rtb1.Text = "The rich text box support underlines, Bold
and Italic text." rtb1.SelStart = rtb1.Find("underlines") rtb1.Span ("underlines") rtb1.SelUnderline = True
rtb1.SelStart = 0 rtb1.SelStart = rtb1.Find("Bold") rtb1.Span ("Bold") rtb1.SelBold = True
Conti…
rtb1.SelStart = 0 rtb1.SelStart = rtb1.Find("Italic") rtb1.Span ("Italic") rtb1.SelItalic = True rtb1.SelStart = 0 rtb1.SelStart = rtb1.Find("underlines") rtb1.Span ("underlines") rtb1.SelFontName = "Arial" rtb1.SelFontSize = 18End Sub
Output
Slider Control
To Set the value of a point on a graphTo select the range of number to be passed into the arrayTo resize a form, field or other graphic object
How to open a slider
Operations using Slider
ValueMin, MaxTickfrequencyTickstyleSmallchangeLargespaceSelect rangeSelstartSellength
Selecting a Slider’s Orientation
ccOrientationhorizontal (value 0, the default) Orients the slider horizontally
ccOrientationvertical (value1) Orients the slider vertically
Slider1.orientation=ccorientationvertical
Setting a Slider’s Range
Slider1.Max=90Slider1.Min=50
Handling Slider Events
Private Sub Form_Load()Slider1.Max = 250Slider1.Min = 0Slider1.LargeChange = 5Slider1.TickFrequency = 25End Sub
Private Sub Slider1_Change() txt1.Text = "slider position" & Str(Slider1.Value)End Sub
Conti…
Private Sub Form_Load() Slider1.Max = 100 Slider1.Min = 0 Slider1.LargeChange = 5 Slider1.TickFrequency = 10 Slider1.TickStyle = sldNoTicks End Sub
THANKS