The Electricity Bill calculation create in visual Basic In coding with form design .
The create a program and Electricity Bill Preparation in Visual Basic .
The Electricity Bill calculation Procedure Step : -
- Step 1 : Start
- Step 2 : Go to the sql and create a table.
- Step 3 : Then open the Visual Basic range.
- Step 4 : Create label , Textbox and Command button etc.
- Step 5 : Write a coding required for Electricity Bill calculation and details.
- Step 6 : Click on Project -> Component -> Microsoft AND DATA control.
- Step 7 : Click on project -> Reference -> Microsoft of Library.
- Step 8 : Go to control panel - > Administrator tools - > ODBC .
- Step 9 : Table Connected .
- Step 10 : Output Will Display .
- Step 11 : End .
Electricity Bill calculation DATABASE CREATION : -
Create table tneb8015 (meterno numeric , customername varchar (20) , address varchar (20)
, billdate date , Prevread numeric , current numeric , billamount numeric )
The Electricity Bill calculation Form Design
GENERAL : -
Dim con As New ADODB . Connection
Dim rs As New ADODB . Recordset
FOR INSERT COMMAND BUTTON : -
Private Sub Command1 _ Click ()
rs . AddNew
rs !metreno = Val (Text1.Text)
rs! customername = Trim(Text2.Text)
rs!address = Trim(Text3.Text)
rs!billdate = Cdate(Text4.Text)
rs!prevread = val(Text5.Text)
rs!curread = val(Text6.Text)
rs!unticonsume = val(Text7.Text)
rs!unitamount = val(Text8.Text)
rs!billamount = val(Text9.Text)
rs . Update
MsgBox “ one record inserted ”
End Sub
FOR SEARCH COMMAND BUTTON : -
Private Sub Command2 _ Click ()
Dim search As New ADODB . Recordset
Dim qry As String
Dim I As integer
I=InputBox(“enter the register number to search”)
qry= “select*fromTNEB8015where regno=” & i
rssearch.Openqry ,con ,adOpenStatic,adLockOptimistic
If search.EOF Then
MsgBox “ no such Meter number ”
Else
Text1.Text = rssearch ! meterno
Text2.Text = rssearch ! customername
Text3.Text = rssearch ! address
Text4.Text = rssearch ! billdate
Text5.Text = rssearch ! prevread
Text6.Text = rssearch ! curread
Text7.Text = rssearch ! unticonsume
Text8.Text = rssearch ! unitamount
Text9.Text = rssearch ! billamount
End If
End Sub
FOR REPORT : -
Private Sub Command3_ Click()
DataReport1.Show
End Sub
FOR CLEAR COMMAND : -
Private sub Command4_ Click()
Text1.Text = “ “
Text2.Text = “ “
Text3.Text = “ “
Text4.Text = “ “
Text5.Text = “ “
Text6.Text = “ “
Text7.Text = “ “
Text8.Text = “ “
Text9.Text = “ “
Text1.SetFocus
End Sub
FOR EXIT COMMAND : -
Private Sub Command5 _ Click ()
End
End Sub
FORM Load
Private Sub From _ Load()
Text4 . Text = Date
Tex5 . Text = 100
Form . WindowState = 2
Con . open “dsn=shame8015; uid=day; pwd=day1”
rs .open “ select *from marksheet8015”,con,adOpenDynamic ,adLockOptimistic
MsgBox “ database connected ”
End Sub
Private Sub Tex6 _ Change ()
Text7 . Text = Val (Text6 . Text) – Val(Text5 . Text)
IfText7 . Text > 100 And Text7 . Text < 300 Then
Text8 . Text = 3
ElseIf Text7 . Text > 300 And Text7 . Text < 500 Then
Text8 . Text = 5
ElseIf Text7 . Text > 500 And Text7 . Text < 700 Then
Text8 . Text = 7
ElseIf Text7 . Text > 700 And Text7 . Text < 1000 Then
Text8 . Text = 10
End If
Text9 . Text = Val(Text7 . Text) * Val(Text8 . Text)
End Sub
Electricity Bill calculation REPORT : -
Meterno : |
8015 |
Customername : |
Rahman |
Address : |
Pattah |
Billdate : |
2019-10-09 |
Prevread : |
100 |
Curread : |
500 |
Unitconsume : |
400 |
Unitamount : |
5 |
Billamount : |
2000 |
No comments:
Post a Comment