?
Solved

A easy function question

Posted on 2007-11-21
3
Medium Priority
?
146 Views
Last Modified: 2010-04-23
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

0
Comment
Question by:leeds2000
  • 2
3 Comments
 
LVL 23

Expert Comment

by:Ashish Patel
ID: 20326568
double click the button  and inside the sub routine block write this
msgbox (finnOrdrenr())
or just write
finnOrdrenr()
0
 
LVL 3

Author Comment

by:leeds2000
ID: 20326573
Uhm, will this return the number i get inside the variable "onr" then?
0
 
LVL 23

Accepted Solution

by:
Ashish Patel earned 1000 total points
ID: 20326623
you will have to fetch that result in a variable for your further use. for example

Dim varonr as Integer = finnOrdrenr()
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month16 days, 19 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question