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

LVL 3
leeds2000Asked:
Who is Participating?
 
Ashish PatelConnect With a Mentor Commented:
you will have to fetch that result in a variable for your further use. for example

Dim varonr as Integer = finnOrdrenr()
0
 
Ashish PatelCommented:
double click the button  and inside the sub routine block write this
msgbox (finnOrdrenr())
or just write
finnOrdrenr()
0
 
leeds2000Author Commented:
Uhm, will this return the number i get inside the variable "onr" then?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.