Sub Routine Within A Shared Subroutine?

Apr 9, 2010

How do I refer to a sub routine from within a shared subroutine? When I try the following code I get this error:Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.

Namespace CmdLineArgs
Friend Class Program
Shared Sub Main(ByVal args As String())[code]....

View 3 Replies


ADVERTISEMENT

Accessing Variables From A Public Shared Subroutine?

Feb 15, 2009

I have created a public shared subroutine in a class file in asp.net 2 (vb.net) web site app_folder.The subroutine retrives some values from a sql database via an sql query and assigns the datareader field values to several variables The problem is I can't seem to assign the variables from the subroutine to the variables and textbox controls in the asp.net page I am calling the subroutine from. The textbox text value just appear blank.By the way, if I response.write the variables in the subroutine they appear populated by the sql data reader.

View 9 Replies

Shared Subroutine Library For Console Applications?

Sep 29, 2009

VB.net newbie question: I am writing a number of console applications, all of which need to use a set of common functions and subroutines that are compiled directly into the applications, not into a separate DLL.

I assume that each separate console application needs to be a separate project, and that the commonly used functions and subroutines need to be in a separate module, but how can such a module be shared between multiple projects so that only one copy of the shared module and its code is required, without creating a separate DLL?

View 2 Replies

Fire The Timer Or Other Routine While Still The WHILE TRUE Routine Checks For Incoming Connections And Messages?

Jan 24, 2012

I am using sockets to send message between computers. I send the messages alright. What I want is when the message "x0x" comes, the client must be closed within 5 minutes. Teh admin can cancel the request by sending message "-xx" as well. The routine that checks for incoming connections and accepts messages uses WHILE TRUE...END WHILE since it must always listen. Once I get a message, I need to fire a timer control or other that fires within 5 minutes. But the program cant leave the WHILE TRUE at all. If i exit it early, the timer fires and the program does get exit. How do I fire the timer or other routine while still the WHILE TRUE routine checks for incomin connections and messages?

View 5 Replies

Reference A Particular Code Routine In .net External To The Current Loop/routine?

Apr 17, 2011

is there any way to reference a particular code routine in VB.net external to the current loop/routine?Example:

If Var01 < 5
[Routine A]
Else
[Routine B]
End If

where Routine A and Routine B are code sequences at the end of the entire program -- such as outside of the current sub or class? The idea would be to reference an otherwise repetitive code.

View 4 Replies

Asp.net - Share A Variable From Sub Routine To Sub Routine?

Mar 3, 2009

I have a sub routine where I pull in information from a database. I want to use variables from this sub routine in another sub routine. I tried making everything public but it doesn't want to be friendly and share.

Dim strEmail as String
Public Sub readDB()
strEmail = "whatever@doohikcy.com"

[Code]....

The readDB would read the database and set the variables and do whatever it needs to do. Then when they submit the form it would e-mail the form to whatever the email address was.

View 2 Replies

.net - Why Can't Call Private Shared Methods From A Public Shared Method

Aug 25, 2011

I have a class like this:

[Code]...

It works, when I make getBar methods public, but I don't want to expose these unneccessarily. Why I can't call private shared methods from a public one in the same class is over my head. I'm using .net framework 4.0 in a web application.

View 1 Replies

Asp.net - Public Shared Variable Shared Between Users?

Mar 30, 2012

I've taken over the maintenance of the website (ASP.NET VB) and on one particular page I noticed the below code

Inherits System.Web.UI.Page
Public Shared UserNumber As String
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init

[Code]....

My question is whether the variable UserNumber can be accessed or changed by any other user than the current one?

View 2 Replies

Shared Method Not Calling Shared Constructor

Aug 12, 2009

Given in the following language specification, for me at least, calling Db.Foobar() [In the following code] does not indeed call off to the Shared Constructors of the base classes. I am curious as to a) is this my own fault for doing something wrong or b) is this an error in the language specification[code]...

View 2 Replies

Create A "shared" Variable That Is Shared With All Instances Of A Class?

Jan 14, 2011

I seem to be drawing a blank. I'd like to create a "shared" variable that is shared with all instances of a class but not classes that inherit from it. For example.Class A: Shared list As New List(Of String): list.Add("A")

Class B Inherits A: list.Add("B")Class C Inherits B: list.Add("C")The end result I'd like is that any instance of A has just A in the list. Any instance of B has A and B in the list. Any instance of C has A, B, and C in the list. I can accomplish it by creating Instance variables, but I have to construct the list for each instance of a class. I'd like to construct it once for a specific point in the Hierarchy and then share it accross other instances of that class.

View 12 Replies

Use Derived Class Shared Variables In Shared Methods Of Base Class?

Jun 4, 2010

I am trying to add shared members in derived classes and use that values in base classes...

I have base

class DBLayer
public shared function GetDetail(byval UIN as integer)
dim StrSql = string.format("select * from {0} where uin = {1}", tablename, uin)
end function
end class

[Code]..

currently there is error using the tablename variable of derived class in base class but i want to use it i dun know other techniques if other solutions are better then u can post it or u can say how can i make it work? confused...

View 2 Replies

Where Has The Subroutine Gone

May 9, 2010

I am trying to get the hang of this stupid VB.net, but it won't even let me create a subroutine or function, it use to be in the tools menu in VB6. I have spent £50 on 2 books that rabbit on about objects, property's classes etc: but tell me nothing of what I want/need to know, what a waste of money.

View 14 Replies

Don't Understand What This Subroutine Is Doing

Dec 4, 2011

Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
Dim d As Integer
Dim price(20) As Double ' Adjusted close price

[code]....

What is the for ... next loops in the second subroutine doing? What is the sim() array meaning?

View 3 Replies

Get X Value Form Another Subroutine?

Jul 23, 2009

Does anyone know how to get x value form another subroutine?

View 3 Replies

Subroutine Triggering Too Soon?

May 1, 2010

I have a form that is bound to a table of data. I have a typical binding navigator. When I go to a different record such as next, previous, first or last I need a subroutine named "LayoutAdjust()" to execute "after" the new next record data is loaded on form. I tried calling the subroutine in the "BindingNavigatorMoveNextItem_Click" action but it executed the procedure before the next record data was loaded

View 1 Replies

Add Progress Bar To This Routine?

Jul 30, 2009

What would be the best way to add a progress bar to this routine so that it corresponds with the progress bar?[code...]

View 6 Replies

Have To Hit Tab Key Twice To Fire Routine In Dgv

Jun 22, 2010

When entering a value in dgv I want the Tab key to fire a routine. Works out ok only thing is I have to hit the Tab twice before it fires. Don't know why, is there a way to prevent it, so that I have to hit the Tab key only once ?

View 1 Replies

Sub Routine Not Executing?

Feb 4, 2011

I have the following code:

Code:
Imports System.Data.SqlClient
Imports System.Data
Public Class Main[code]...

and the sub Exceptionquery is not working. I can verify this because it is supposed to create a new table called scratchpad3. what I may be missing in that sub routine that isn't allowing it to work?

View 8 Replies

Using The SendKeys Routine?

May 28, 2009

I was looking for something send keystrokes and I found this helpful routine SendKeys that I can use in a VB Script. I wanted to have "Right Control Key + (Scroll Lock & Scroll Lock)" sent to the machine. Essentially, having the Right Control Key pressed, I need Scroll Lock pressed twice. Here is what I tried:

set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.SendKeys"^({SCROLLLOCK}{SCROLLLOCK})"

View 3 Replies

Why Is Sub Routine Not Firing

Feb 4, 2011

I have the following code:

Private Sub Exceptionquery()
Dim connection As System.Data.SqlClient.SqlConnection
Dim connectionString As String = "Initial Catalog=mdr;Data Source=xxxxx;uid=xxxxx;password=xxxxx"

[code]....

I get the error Invalid Object name 'Scratchpad3' on this line:

adapter.Fill(ds)

I have tried to debug this and can see that the query is correct, that the values that are being passed to the sql server are correct but it doesnt look like my code is firing off the Exceptionquery Sub. I thought to call a sub all you had to enter was the name of the sub such as this line:

Exceptionquery()

I have also verified that the mapping of the buttonclick event is mapped correctly. I have other subs that I am calling in almost the same way and those work.

View 1 Replies

Array Passing To Subroutine In VB

Feb 7, 2010

I have an old program written in VB6. I upgraded the program with VB 2008. The updated program works fine except when the program tries to transfer an array to another subroutine. The old VB6 program sends arr(0) as an argument to the subroutine, the address of arr(0) is passed to the subroutine. The array arr() address is the first of a block of consequent addresses one by one, arr(1), arr(2), etc.

Now when running VBnet, the address of arr(0) is not the first of all consequent arr(1), arr(2), etc. It is an isolated number, just like if arr(0) were a variable instead of an array. The addresses of arr(1), arr(2), etc do not exist in the subroutine. [Code]

The variable of y1 passes to the subroutine oK, whilst arr(0) passes also like y1 into an isolated address. So VBnet interprets arr(0) like a variable rather than the first value of a long list. I haven't been able to find out why the above sample does not work. I got stuck in my programming effort, as I cannot proceed to to further development. how the code should be modified to enable the whole array information passing through the subroutine.

View 3 Replies

Asp.net - Call Subroutine From Javascript?

Jun 27, 2011

Problem is, I need to call a VB.NET function from javascript, no two ways around it. This is a bit harder to find.BTW -- Web/Page methods won't work. I have to be able to reference a listbox and it's selected items when the VB code-behind fires.

View 3 Replies

Call A Subroutine By Variable Name (In .Net)?

Jun 21, 2010

what I need to do is to call/run/execute a subroutine using a varaible name from a subroutine.

Public Sub Main(ByVal subName as String)
Call subName ' subName may be contain the value AAA or BBB
End Sub

[code]....

View 5 Replies

Call A Subroutine In An IF Statement?

Jun 16, 2012

I am trying to make a counter go up by 1 every time a subroutine is called But i dont know how to word it. Here is the code. [code]...

View 2 Replies

Ending Application From DLL Subroutine?

Feb 23, 2010

I'm writing a class library and I need to be able to shut down the main code in certain cases.

I know I could raise an event and listen for it in the form called by application.run but I would like to find a way around it.I wouldn't be opposed to try to throw an exception that if unhandled would close the application... but would prefer to come up with a more elegant soln.

View 1 Replies

Execute Subroutine At Startup?

Feb 4, 2011

I am trying to execute the "Data()" subroutine at startup. This did not work:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Call Data()
End Sub

Is there a way to call the subroutine at the begining of debug?

View 9 Replies

How To Open Form1_Load() Subroutine

Dec 11, 2011

I'm following this tutorial [URL] and it says to Open form1_Load() subroutine. What does this mean and how do I do so? It is really important.

View 3 Replies

Incrementing When Accessing A Subroutine?

Feb 1, 2010

When you access a subroutine by one or more other subroutines each time the variables are zeroed like 'n' below. How can I keep n saved so main can increment n each time.

Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

[Code]....

View 3 Replies

Page_Load Subroutine Is Not Being Called?

Jan 19, 2011

have a look at my VB/ASP code and tell me if you can see what's wrong (I highlighted the important segments in red):

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<%@Page Explicit="true" Language="VB" Debug="true"

[Code].....

Basically, I'm trying to get the Page_Load subroutine to execute on the page load, but it doesn't seem to be called. I'm assuming that because I set my feedback label to "feedback" in the Page_Load subroutine, I should see it displayed on the page saying "feedback" on first loading the page and every time I refresh. But this doesn't happen. I'm lead to conclude that the Page_Load subroutine is not being called on the page load.

View 4 Replies

Page_Load Subroutine Not Being Called

Jan 19, 2011

VB/ASP code and tell me if you can see what's wrong (I have bolded the important segments):

[Code]...

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved