Link to home
Start Free TrialLog in
Avatar of leeds2000
leeds2000Flag for Norway

asked on

A easy function question

Ok, i know, i never remember HOW to place a function inside a button or similiar

How do i "call" this function inside a button?


Public Function finnOrdrenr() As Integer
 
        Dim forbindelse As New System.Data.OracleClient.OracleConnection
 
        forbindelse.ConnectionString = "user id=****;password=***;data source=*****"
        forbindelse.Open()
 
        Dim kommando As New System.Data.OracleClient.OracleCommand("select ordrner from", forbindelse)
 
        Dim dataleser As OracleClient.OracleDataReader
        dataleser = kommando.ExecuteReader()
        Dim onr As Integer
        While dataleser.Read()
            onr = dataleser.GetInt32(0)
        End While
 
        dataleser.Close()
        forbindelse.Close()
 
        Return onr
    End Function

Open in new window

Avatar of Ashish Patel
Ashish Patel
Flag of India image

double click the button  and inside the sub routine block write this
msgbox (finnOrdrenr())
or just write
finnOrdrenr()
Avatar of leeds2000

ASKER

Uhm, will this return the number i get inside the variable "onr" then?
ASKER CERTIFIED SOLUTION
Avatar of Ashish Patel
Ashish Patel
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial