|
The Form design,
Account_Form.vb
1st
TabPage of TabControl control selected
... |
2nd
TabPage of TabControl control selected
... |
 |
 |
Create Visual Basic .Net Forn - Account_Form.vb
Classes used in this
Form: SqlConnection,
SqlDataAdapter, SqlCommand, DataSet, ImageList,
Label, TextBox, Button,
TabControl, ToolTip
1- Info about database
used
...
SQL database -
RBT Table
- cust_comp
Fields - child_ref, father_ref, type_cur, desc_name.address, phone,
open_usd, db_usd
and cr_usd
2- Create the Form
Account_Form.vb
- On the View
menu , click Solution Explorer
- In Solution
Explorer, right click the RBT Accounting Net,
select Add on the shortcut menu to open other
shortcut menu, click Add New Item, the Add
New Item - RBT Accounting Net dialog box appears.
- In the Add
New Item -RBT Accounting Net dialog box:
- In the
Categories pane, select Local Project
Items
- In the Templates
pane, select Windows form . A message
appears - (a form for Windows Applications).
- In the Name
box, type Account_Form.vb
- Click
Open
- In the
windows Forms Designer appears the empty window
Form design
|
|
1- |
The Form Properties -
Account_Form.vb
|
|
Name: Backcolor: Icon:
Menu: Size: StartPosition: Text: WindowState: |
|
Account_Form Control Icon false (none)
648,360 CenterScreen
Account... Normal | | |
2- |
The Account_Form.vb
design
1st page of the TabControl control selected
...
From
the
Toolbox/Data add one SqlDataAdapter
control. and from the
Toolbox/Windows Form add these controls
.. Nine Label controls, seven
TextBox controls, seven Button controls, two panel controls, one
ToolTip control, one Tabcontrol control
and one ImageList control.
- Add the SqlDataAdapter control,
SqlDataAdapter1
Represents
a set of data commands and a database connection that are
used to fill the DataSet and update a SQL
Server database The SqlDataAdapter, serves as a
bridge between a DataSet and SQL Server for
retrieving and saving data.
From the
Toolbox/Data add SqlDataAdapter
control
...
- The Data
Adapter Configuration Wizard dialog box appears,
click Next
- New Data
Adapter Configuration Wizard dialog box
appears, click New Connection ... The
Data Link Properties dialog box
appears:
- In
Provider Tab, select Microsoft OLE DB
Provider for SQL Server
- In
Connection Tab, type or select your
server name in the Select or enter a server
name combobox
- Select
the Use Windows NT Integrated security
radio button
- Select
the Select the database file as a
database name radio button and from the
combobox select RBT
- Click
Ok.
|
In the
Which data a connection ... combobox display
the names of the server and the database. Click
Next.
- New Data
Adapter Configuration Wizard dialog box appears,
select the Use SQL Statements radio button,
click Next.
- New Data
Adapter Configuration Wizard dialog box appears,
in the what data should ... box
type SELECT child_ref, father_ref,
type_cur, desc_name, address, phone FROM cust_comp
(or click
Query Builder ...), click Next.
- New Data
Adapter Configuration Wizard dialog box
appears, click Finish. new
SqlConnection control - SqlConnection1 added to this
Form
|
The
SqlDataAdapter1 Properties:
Name: DeleteCommand InsertCommand: SelectCommand:
UpdateCommand: |
SqlDataAdapter1 SqlDeleteCommand1 SqlInsertCommand1 SqlSelectCommand1 SqlUpdateCommand, | |
The
SqlConnection1 Properties:
Name: ConnectionString |
SqlConnection1
workstation id=" .... | |
right click the
SqlDataAdapter1 control, on the
shortcut menu click Generate Dataset ..., the
Generate Dataset dialog box appears: Select the New radio
button and in the box type Account_DSet. New
DataSet - Account_DSet.xsd added to the Solution
Explorer and new DataSet control - Account_DSet1
added to the Form design -
Account_Form.vb
- Add the Label
control - ldate,
Properties:
Name: Size: Text: |
ldate 48,16 Today
: | |
- Add the TextBox
control - txttdate,
Properties:
Name: Size: |
txttdate 184,20 | |
- Add the TabControl
control - TabControl1,
Properties:
Name: Size: TabPages: |
TabControl1 624,296 (Collection) | |
Add 2 pages to this
TabControl, when you click
Collection of TabPages property, the
TabPage Collection Editor dialog box appears. In
this Editor add 2 pages
Member |
BackColor |
Text |
Size |
TabPage1 TabPage2 |
Control Control |
By Account All
Account |
616,270 616,270 | |
- Add the Label
control - lnote1,
Properties:
Name: Size: Text: |
lnote1 224,16 After any Input, click
'DoubleClick mouse
' | |
- Add the Button
control - btnNavFirst,
Properties:
Name: ImageList: ImageIndex: Size: |
btnNavFirst ImageList1 0 23,24 | |
- Add the Button
control - btnNavPrev,
Properties:
Name: ImageList: ImageIndex: Size: |
btnNavPrev ImageList1 1 23,24 | |
- Add the Button
control - btnNavNext,
Properties:
Name: ImageList: ImageIndex: Size: |
btnNavNext ImageList1 2 23,24 | |
- Add the Button
control - btnLast,
Properties:
Name: ImageList: ImageIndex: Size: |
btnLast ImageList1 3 23,24 | |
- Add the Button
control - btnAdd,
Properties:
Name: ImageList: ImageIndex: Size: |
btnAdd ImageList1 4 23,24 | |
- Add the Button
control - btn,Update
Properties:
Name: ImageList: ImageIndex: Size: |
btnUpdate ImageList1 5 23,24 | |
- Add the Button
control - btnclose,
Properties:
Name: ImageList: ImageIndex: Size: |
btnclose ImageList1 6 23,24 | |
- Add the Panel
control -
Panel1
- Add the Panel
control -
Panel2
- Add the Label
control - lblNavLocation,
Properties:
Name: Size: Text: |
lblNavLocation 95,16 No
Records | |
- Add the TextBox
control - editchild_ref,
Properties:
DataBindings
Text: Name: Size: |
Account_DSet1 -
cust_comp.child_ref teditchild_ref 256, 20 | |
- Add the TextBox
control - editfather_ref,
Properties:
DataBindings
Text: Name: Size: |
Account_DSet1 -
cust_comp.father_ref editfather_ref 256, 20 | |
- Add the TextBox
control - edittype_cur,
Properties:
DataBindings
Text: Name: Size: |
Account_DSet1 -
cust_comp.type_cur edittype_cur 256, 20 | |
- Add the TextBox
control - editdesc_name,
Properties:
DataBindings
Text: Name: Size: |
Account_DSet1 -
cust_comp.desc_name editdesc_name 256, 20 | |
- Add the TextBox
control - editaddress,
Properties:
DataBindings
Text: Name: Size: |
Account_DSet1 -
cust_comp.address editaddress 256, 20 | |
- Add the ComboBox
control - editphone,
Properties:
DataBindings
Text: Name: Size: |
Account_DSet1 -
cust_comp.phone editphone 256, 20 | |
- Add the Label
control - Labels_0,
Properties:
Name: Size: Text: |
Labels_0 90,17 Account
Id | |
- Add the Label
control - Labels_1,
Properties:
Name: Size: Text: |
Labels_1 90,17 Father
Account Id | |
- Add the Label
control - Labels_2,
Properties:
Name: Size: Text: |
Labels_2 90,17 Currency | |
- Add the Label
control - Labels_3,
Properties:
Name: Size: Text: |
Labels_3 90,17 Name | |
- Add the Label
control - Labels_4,
Properties:
Name: Size: Text: |
Labels_4 90,17 Address | |
- Add the Label
control - Labels_5,
Properties:
Name: Size: Text: |
Labels_5 90,17 Phone | |
- Add the ImageList
control - ImageList1,
Properties:
Name: Images: ImageSize: TransparentColor: |
ImageList1 (Collection) 16,16 Transparent | |
Add image
to this ImageList: When you click
Collection of Images property, the
Image Collection Editor dialog box
appears. In
this Editor dialog click Add, the Open
Dialog box appears In the Open dialog,
display list of files stored in the folder c:\RBT
Accounting Net\pic In the Filename combo box
type First.bmp In the Files Type combo box
choose All image ... and then click
Open Automatically, lists of information display
in the Image Collection Editor dialog box Repeat this
operation to be add the following bmp files: Prev.bmp,
Next.bmp, Last.bmp, New.bmp, Save.bmp and
Close.bmp And then click OK
- Add the ToolTip
control -
ToolTip
2nd page of the TabControl
control selected
...
From the
Toolbox/Windows Form add one DataGrid
control
- Add the DataGrid
control - DataGrid1,
Properties:
Name: DataMember: DataSourse: Size: Table
Styles: |
DataGrid1 cust_comp
Account_DSet1 600,256 (Collection) | |
when you click
Collection of Table Styles property, the
DataGridTableStyle Collection Editor dialog box
appears. In this Editor, click Add. - ( add 1
DataGridTableStyle)
Members
pane |
DataGridTableStyle1
Properties |
DataGridTableStyle1 |
Name: GridColumnStyles: MappingName: |
DataGridTableStyle1 (Collection) cust_comp | | | |
when you click
Collection of
GridColumnStyles property, the
DataGridColumnStyles Collection
Editor dialog box appears. In this Editor add
6
DataGridTextBoxColumns
Members
pane |
DataGridTextBoxColumn1/2/3/4/5/6
Properties |
DataGridTextBoxColumn1 |
Header
|
Width |
MappingName |
Account Id |
75 |
child_ref |
|
DataGridTextBoxColumn2 |
Header
|
Width |
MappingName |
Father |
75 |
father_ref |
|
DataGridTextBoxColumn3 |
Header
|
Width |
MappingName |
Currency |
60 |
type_cur |
|
DataGridTextBoxColumn4 |
Header
|
Width |
MappingName |
Name |
120 |
desc_name |
|
DataGridTextBoxColumn5 |
Header
|
Width |
MappingName |
Address |
130 |
address |
|
DataGridTextBoxColumn6 |
Header
|
Width |
MappingName |
Phone |
75 |
phone |
|
|
Click Ok.
And then click Ok. New
Columns display in the DataGrid
control
|
|
| |
The codes ...
|
|