Solved

A easy function question

Posted on 2007-11-21
3
127 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 250 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

816 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now