Controls
Controls
1)button.
private sub button1_click(byval sender as system.object, byval e as
system.eventargs) handles button1.click
dim cek as new checkbox
cek.size = new size(100, 20)
cek.checkstate = checkstate.indeterminate
cek.text = "checkbox1"
cek.checked = true
me.controls.add(cek)
end sub
end sub
#region "timer"
private sub timer1_tick(byval sender as system.object, byval e as
system.eventargs) handles timer1.tick
progressbar1.value += 1
if progressbar1.value = progressbar1.maximum then
timer1.enabled = false
end if
end sub
#end region
end class
5)trackbar
private sub trackbar1_scroll(byval sender as system.object, byval e as
system.eventargs) handles trackbar1.scroll
textbox1.text = "the track bar value is:" & trackbar1.value
end sub
end class
end sub
end class
7)timer
dim balarm as boolean
private sub timer1_tick(byval sender as system.object, byval e as
system.eventargs) handles timer1.tick
lbltimer.text = timeofday
if txthour.text <> "" and txtmin.text <> "" and txtsec.text <>
"" then
dim alarm = new datetime(today.year, today.month,
today.day, val(txthour.text), val(txtmin.text), val(txtsec.text))
if now >= alarm and balarm then
beep()
lbltimerevent.text = "alarm on"
end if
end if
end sub
private sub button1_click(byval sender as system.object, byval e as
system.eventargs) handles button1.click
timer1.enabled = true
end sub
private sub rdotimer1_checkedchanged(byval sender as system.object,
byval e as system.eventargs) handles rdotimer1.checkedchanged
if rdotimer1.checked = true then
balarm = true
end if
end sub
end class
8)tooltip & erroer provider
private sub tooltipanderrorprovider_load(byval sender as system.object,
byval e as system.eventargs) handles mybase.load
tooltip1.settooltip(textbox1, "enetr the name")
tooltip2.settooltip(textbox2, "enetr the password")
end sub
end sub
end class
9)tab page control
private sub panel1_paint(byval sender as system.object, byval e as
system.windows.forms.painteventargs) handles panel1.paint
tooltip1.settooltip(textbox1, "enter your name")
tooltip2.settooltip(textbox2, "enter your password")
end sub
'end if
'manual-color dialogclass
dim color as new colordialog
if (color.showdialog <> dialogresult.cancel) then
lbl_color.text = "this is new color"
lbl_color.forecolor = color.color
end if
end sub
end class
12)font dialogbox
private sub btn_display_click(byval sender as system.object, byval e as
system.eventargs) handles btn_display.click
'toolbox-font dialogbox
if fontdialog2.showdialog <> dialogresult.cancel then
rich_font.font = fontdialog2.font
rich_font.forecolor = fontdialog2.color
end if
end sub
end sub
private sub openfiledialog3_fileok(byval sender as system.object,
byval e as system.componentmodel.canceleventargs) handles
openfiledialog3.fileok
openfiledialog3.showhelp = true
end sub
end class
14)print dialog box
private sub printdialogclass_load(byval sender as system.object, byval
e as system.eventargs) handles mybase.load
richtextbox1.text = "on a new form drag a printdialog,
printdocument,printpreviewcontrol, printpreviewdialog, pagesetupdialog,
mainmenu and a richttextbox contol. select mainmenu and in the part,
type file and under file type print, printpreview, pagesetup and
ppcontrol. the menu should look like this:file->print, printpreview,
pagesetup, ppcontrol. the richtextbox control is used to load some text
in it which will be ready to print. the form in design view should look
like the image below"
end sub
end sub
end if
end sub
end sub
end class