|
The Form design,
ExchangForm.vb
1st
TabPage of TabControl control selected
... |
2nd
TabPage of TabControl control selected
... |
 |
 |
Create Visual Basic .Net Forn - ExchangForm.vb
Classes used in this
Form: SqlConnection,
SqlDataAdapter, SqlCommand, DataSet, ImageList,
Label, TextBox, Button,
TabControl, DateTimePicker, ToolTip
1- Info about database
used
...
SQL database -
RBT Table
- chang
Fields - ch_date, llrate_usd, rate_ll, rate_eur, rate_eng
and rate_jap
2- Create the Form
ProductForm.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 ExchangForm.vb
- Click
Open
- In the
windows Forms Designer appears the empty window
Form design
|
|
1- |
The Form Properties -
ExchangForm.vb |
|
Name: Backcolor: Icon:
Menu: Size: StartPosition: Text: WindowState: |
|
ExchangForm Control Icon false (none)
560,344 CenterScreen Exchange... Normal | | |
2- |
The
ExchangForm.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
..
Twelve Label controls,
Twelve
TextBox controls, seven Button controls, one
DateTimePicker control, one panel control, 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 ch_date, llrate_usd,
rate_ll, rate_eur, rate_eng, rate_jap FROM chang
ORDER BY ch_date (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 ExchangDSet New
DataSet - ExchangDSet.xsd added to the Solution
Explorer and new DataSet control - ExchangDSet1
added to the Form design -
ExchangForm.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 536,288 (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
day All days |
536,288 536,288 | |
- Add the Label
control - lnote1,
Properties:
Name: Size: Text: |
lnote1 224,16 After any Input, click
'DoubleClick
' | |
- 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, Properties:
- Add the Label
control - lblNavLocation,
Properties:
Name: Size: Text: |
lblNavLocation 95,16 No
Records | |
- Add the DateTimePicker
control - DT_date,
Properties:
- Add the TextBox
control - editch_date,
Properties:
DataBindings
Text: Name: Size: |
ExchangDSet1 - chang.ch_date
editch_date 128,20 | |
- Add the TextBox
control - editrate_usd,
Properties:
DataBindings
Text: Name: Size: |
ExchangDSet1 - chang.rate_usd
editrate_usd 100,20 | |
- Add the TextBox
control - editrate_ll,
Properties:
DataBindings
Text: Name: Size: |
ExchangDSet1 - chang.rate_ll
editrate_ll 100,20 | |
- Add the TextBox
control - editrate_eur,
Properties:
DataBindings
Text: Name: Size: |
ExchangDSet1 - chang.rate_eur
editrate_eur | |
- Add the TextBox
control - editrate_eng,
Properties:
DataBindings
Text: Name: Size: |
ExchangDSet1 - chang.rate_eng
editrate_eng 100,20 | |
- Add the TextBox
control - editrate_jap,
Properties:
DataBindings
Text:
Name:
Size: |
ExchangDSet1 - chang.rate_jap
editrate_jap
100,20 |
|
- Add the TextBox
control - Txtusd,
Properties:
Name:
Size:
Text: |
Txtusd
100,20
1.00 |
|
- Add the TextBox
control - Txtll,
Properties:
Name:
Size:
Text: |
Txtll
100,20
1.00 |
|
- Add the TextBox
control - Txteur,
Properties:
Name:
Size: |
Txteur
100,20 |
|
- Add the TextBox
control - Txtuk,
Properties:
- Add the TextBox
control - Txtjap,
Properties:
- Add the Label
control - Labels_0,
Properties:
Name: Size: Text: |
Labels_0 121,17 USD -
United State | |
- Add the Label
control - Labels_1,
Properties:
Name: Size: Text: |
Labels_1 121,17 LL -
Lebanese Pound | |
- Add the Label
control - Labels_2,
Properties:
Name: Size: Text: |
Labels_2 121,17 EUR -
Europe | |
- Add the Label
control - Labels_3,
Properties:
Name: Size: Text: |
Labels_3 121,17 UK - United Kingdom | |
- Add the Label
control - Labels_4,
Properties:
Name: Size: Text: |
Labels_4 121,17 JAP -
Japan | |
- Add the Label
control - Labels_5,
Properties:
Name: Text: |
Labels_5 Currency Type | |
- Add the Label
control - Labels_6,
Properties:
Name:
Text: |
Labels_7
Value $ |
|
- Add the Label
control - Labels_7,
Properties:
Name:
Text: |
Labels_7
Value LL |
|
- Add the Label
control - Label_1,
Properties:
Name: Text: |
Labels_7 Date : | |
- 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 - grdChang,
Properties:
Name: DataMember: DataSourse: Size: Table
Styles: |
grdChang chang ExchangDSet 512,232 (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)
chang | | | |
when you click
Collection of
GridColumnStyles property, the
DataGridColumnStyles Collection
Editor dialog box appears. In this Editor add
5
DataGridTextBoxColumns
Members pane
|
DataGridTextBoxColumn1/2/3/4/5/6 Properties |
DataGridTextBoxColumn1 |
Header
|
Width
|
MappingName
|
Date |
75 |
ch_date |
|
DataGridTextBoxColumn2 |
Header
|
Width
|
MappingName
|
Rate USD\LL |
75 |
llrate_usd |
|
DataGridTextBoxColumn3 |
Header
|
Width
|
MappingName
|
Rate LL\US |
75 |
rate_ll |
|
DataGridTextBoxColumn4 |
Header
|
Width
|
MappingName
|
Rate EUR\US |
75 |
rate_eur |
|
DataGridTextBoxColumn5 |
Header
|
Width
|
MappingName
|
Rate UK\US |
75 |
rate_eng |
|
DataGridTextBoxColumn6 |
Header
|
Width
|
MappingName
|
Rate
JAP\US |
75 |
rate_jap |
|
|
Click Ok.
And then click Ok. New
Columns display in the DataGrid
control
|
|
| |
The codes ...
|
|