Dim bill As integer=textbox14.text
Module1.billno = bill
Form18.txtbillno = Module1.billno
Value of Type 'Integer' cannot be converted to System.Windows.Forms.Textbox
Are you using data encapsulation or just sending to Module1's public variable?
(Encapsulation would be using public Properties)
Example:
'Declare local variable
Private iBill as Integer
Public Property CurrentBill as Integer
Get
Return me.iBill
End Get
Set (value as Integer)
Me.iBill = Value
End Set
End Property
-Or-
You can try the following:
Dim bill As Integer = TryCast(textbox14.text,Integer)
If IsNothing(bill) = False Then
Module1.billno = bill
Else
MsgBox("Cast not successful")
End If
No.in the module I declared all the varibles used in the whole application................
Dim bill As integer=textbox14.text
You have to convert textbox14.text from string to integer. One way to do this is
If IsNumeric(textbox14.text) Then
bill = textbox14.text
Else
'textbox14.text is not a number
End If
As for the rest, I'll assume the error occurred on line 3 (you didn't specify) and that the error is because txtbillno is a textbox in which case the code should be
Form18.txtbillno.Text = Module1.billno
Dim bill As integer=textbox14.text
Module1.billno = bill
Form18.txtbillno = Module1.billno
txtbillno is a textbox so u are getting the error....
u need to add .Text after the textbox object
Form18.txtbillno.Text = Module1.billno
Thank you very much to both of u'll. it worked.
I declare the varilble in form18 as
Public tolal As Double
can't assign value to in from form7 as like this........
Form18.total = Module1.dailytotalamount
but i got error as:
form18.total is not accessible in this context it is private ?
If the declaration is in anything private than it is in accessable.
Can you post the bit of code for the declaration?
i have already posted the way i declare the the varibles ............
this the way i hava assigned the varibles
Public class form18
Dim connectionstring As String = Module1.connectionString
Dim sqlconn As New SqlConnection(connectionString)
Public sqlDataset As New DataSet
Dim myCommand1 As SqlCommand
Public SQLdr As SqlDataReader
Dim myConnection As SqlConnection
Dim nxtmajor As Integer
Dim sqlcmd As New SqlCommand
'Dim dep As String
Dim tbStudent As DataTable
Dim total As Integer
'Dim sname As String
Public tolal As Double
Public totdue As Double
Public payed As Double
Public bill As Integer
Public mode As String
Dim myCommand As SqlCommand
U have two variables
Dim total as Integer and it wont be accessible
Public tolal as Double is accessible
but in your code
Public tolal As Double ' tolal is public
Form18.total = Module1.dailytotalamount ' total is not public....
u have declared tolal as public but not total
okay thank you.............
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.