Solved

A easy function question

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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 …
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

705 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

15 Experts available now in Live!

Get 1:1 Help Now