TabControl - PowerPoint PPT Presentation

1 / 14
About This Presentation
Title:

TabControl

Description:

date2 = Me.DateTimePicker2.Value.Date ... E.g. string1 = 'dont kill me' String2 = string1.substring(5) starting at 5th position ... – PowerPoint PPT presentation

Number of Views:94
Avg rating:3.0/5.0
Slides: 15
Provided by: mche6
Category:
Tags: tabcontrol | dont

less

Transcript and Presenter's Notes

Title: TabControl


1
TabControl
  • TabControl is used to show multiple pages on the
    same form.

2
TabControl
  • Use the collection editor to add tabpages

3
DateTimePicker Substract
  • Getting the difference between 2 dates.
  • date1 Me.DateTimePicker1.Value.Date
  • date2 Me.DateTimePicker2.Value.Date
  • Use the subtract method to get the difference
    between date1 and date2
  • numdays date2.Subtract(date1).TotalDays

4
String Methods
  • Part of a string
  • E.g. string1 dont kill me
  • String2 string1.substring(5) ? starting at 5th
    position
  • String2 becomes kill me
  • String2 string1.substring(5,4) ?start at 5th ,
    take 4 chars.
  • String 2 becomes kill

5
String Methods Indexof
  • To find a position in the string, e.g. where is
    in abc 100. Use the indexof method
  • ix string1.indexof() Now is the 4th
    position.
  • To get 100, we use
  • String2 string1.substring(ix,3)
  • Where ix is the start position and 3 is the
    number of characters to get.

6
String Trim method
  • To remove blanks (spaces) from inputs,
  • Use
  • String1 textbox1.text.trim().
  • E.g.
  • Trim removes the spaces before and after 100.

___100___
7
Split function
  • E.g s1 1,1,0,1,0,1
  • We dim AA(5) as string
  • AA Split (s1, ,)
  • 1,1,0,1,0,1
  • AA
  • S1 will be split into the 6 elements of AA using
    the ,.

8
Join Function
  • Join is the reverse of Split
  • S1 Join (AA, )
  • Here, AA is
  • S1 becomes 110101

9
Multiforms (contd)
  • In form1

Form2
Dim f2 as New form2 f2.showdialog()
Note form1 controls form2, and form1 can see the
labels, textboxes in form2. Form2 cannot see
form1. Do not, in form2, NEW a form1.
10
Forms owner
  • When in form1, you new form2, form1 owns form2.
  • In order to allow form2 to see form1s labels,
    use the owner property.
  • Make form2s owner equals to form1

Form1 form2
Dim f2 as New form2 f2.owner me Label1.text
111 f2.showdialog()
Dim f1 as form1 Not new Sub form_load ( f1
me.owner me is form2 username f1.
Label1.text
11
Array of Controls
  • Instead of referencing checkbox1,checkbox2,
    Checkbox3. You can dim an array of checkboxes.

12
Array of Checkboxes
  • First dim an array CK ( ) as checkbox.
  • CK(i) New Checkbox ? Note new creates the
    checkbox
  • Set the location of the checkbox.
  • Add the checkbox-i to the form using
  • Me.controls.add(CK(i))
  • Now the checkboxes can be access as CK(i).

13
StreamWriters
  • Dim fout As StreamWriter
  • fout New StreamWriter (badcourt1)
  • fout.writeline(0,1,0,0,0,0,1,1,1)
  • Sub closefile_click
  • fout.close()
  • End sub

14
StreamReaders
  • StreamReaders
  • Dim fin As StreamReader
  • fin New StreamReader (badcourt1)
  • Dim AA(5) as string
  • Dim line as string
  • Do While (fin.Peek() ltgt -1)
  • line fin.ReadLine()
  • AA Split(line, ",")
  • Loop
Write a Comment
User Comments (0)
About PowerShow.com