Public Subs Don't Work
Jun 2, 2012
I have a form named FrmDrvouchers. It contains some public subprocedures.I call these subs from another form which opens from a form which is opened from FrmDrVouchers as a dialog.When I open FrmDrvouchers directly, everything works. But when I call FrmDrvouchers from another project which is also part of this solution, its public subs don't work when I call them from another (dialog) form.
Here is the code of the Button Click from which I open FrmDrvouchers:
Dim FrmDrv As FrmDrVouchers = New FrmDrVouchers()
FrmDrv.Show()
This works, but those public subs don't. Why?It just skip what i want to do, but not throws any Exceptions,Now I m posting my Code,,, plz have a look on that,,Here is my Main form's MenuStrip Button Click code :
Private Sub CashPaymentToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CashPaymentToolStripMenuItem.Click
Dim DrVouchers As Transactions.FrmDebitVouchers = Transactions.New FrmDebitVouchers()
[code]....
View 1 Replies
ADVERTISEMENT
Jun 20, 2011
I have an array that I created in a sub with a button. I was wondering how I could use this array in other subs after it has been created. I tried making it public and global, but it didn't work.
View 10 Replies
Jul 19, 2010
If you have a class with a PRIVATE constructor.>>
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim example1 As New ExampleClass[code]......
View 5 Replies
Nov 17, 2009
Basicly I have a set of public subs, (not related to a form), inside a public class, and all of them share a variable. One of the subs, the one called for first gives the variable a value.
When the next sub is called, the variable is null. The data in the variable has been erased as the execution of the prior public sub ended I'm guessing.
View 7 Replies
Jul 19, 2009
i have have a few questions about the syntax of the lan.:
1) What is the 'Get' statement and when do you use it?
2) Whats the difference between public, private, protected etc... when declaring functions and subs.
3) When would you use the overrides property?
View 4 Replies
Oct 13, 2011
when i turn on "option strict" i can not us a sub to set all forms in project to same size?
I call the routine byref MY. i also use a common sub to draw the same border lines on all forms.
must i now copy the same code to all forms?
View 6 Replies
Dec 15, 2009
I am writing a control application for an inteface card. The complicated work of initialising communication with the card is written and working fine. However, my problem is to update the text in a dialog label on the communication interface form from a module that contains all the coding for accessing the inteface card. From the module, the interface dll returns data that describes some typical connection errors and the module then calls on Public Subs in the form to display error messages; for example:This is the Public Sub in the Module that initiates communication with the interface card:
Public Sub OpenDeviceInterface()
DeviceID = 1 - My.Resources.DeviceID
h = OpenDevice(DeviceID)
Select Case h
Case 0, 1, 2, 3
[code]....
What happens when these Public subs are called from the module is that the MSgBoxes I made to test the routine show up but the label text doesn't appear.I've tried; Refresh, on the label and the form without success...
View 4 Replies
Jun 15, 2009
I'm trying to call a private sub in another private sub. For example ;
[Code]....
View 13 Replies
Oct 26, 2009
When you refrence a Function like this one:[code]You may want to be able to get more out of that, like this.[code]So how would I be able to add subs or functions onto a sub or function like that?
View 4 Replies
Feb 10, 2011
I can access a module from code behind but not from the aspx page in inline VB code <% ... %>.
View 2 Replies
Apr 7, 2011
Imports System
Imports System.Threading
Imports System.ComponentModel[code]....
how to declare "smsport" on class smscomms as public so that it can be access in class form1 or button1_click event.
View 5 Replies
Aug 26, 2010
How do declare a public variable .aspx web page that can be used in all the pages within my web application?
View 3 Replies
May 20, 2010
Can I code to add transaction for some subs? If there is an error in any sub will roll back.For example,
sub1 delete some tables
sub2 insert data into tables which just be deleted
sub3 send out confirmation email
sub4 make submit button disable
I knew that transaction will work for sub1 and sub2 but I do not know if transaction will work for all of subs
View 1 Replies
Feb 2, 2009
Just wanted to start out by saying that I am completely new at this whole programming thing. I am pretty sure the answer is very simple and staring me right in the face but I can't figure it out.Basically, what I want to do is check to see if a directory exists and if it does not, then create it. Then I want to populate a list box with a list I have stored in a text file.
The problem I run into is that while my program runs, as far as I can tell my Subs do not. I just want them to run on their own when the program starts but they don't.
Imports Microsoft.VisualBasic
Imports System.IO
Public Class myProgram
[code].....
View 3 Replies
Jun 9, 2010
I want to add a description for my subs :
My Website [URL]
View 2 Replies
Feb 7, 2012
I'm working on my program and I have 10 subs that grab 10 files and format them. Is it possible to run more than one sub at once? I tried to google it but there doesn't seem to be much available... If anyone could just point me in the right direction, that would be awesome!!
[Code]...
View 2 Replies
Feb 21, 2010
I was reading the lesson on how to use functions and subs and I'm having a bit of a hard time understanding this part:
[Code]...
View 4 Replies
Aug 31, 2010
I'm trying to use the Fade In/Out subs. Currently the fade in works perfectly. The fade out is the one I am having problems with. In my form's closing event:
[Code]...
I really think the problem is when it is calling for a "new object", but I don't know what to put in place of it to just work on the old object. I wanted to see if anyone has a solution to this issue, or perhaps an alternate solution that fades out just as nicely as the fade in.
View 10 Replies
May 22, 2010
Is there a way to stop other subs from running while in a separate sub.
for instance say your in the sub
CreateNumber()
and the subs are setup like
CreateNumber()
AddNumber()
DeleteNumber()
Is there a way to be in CreateNumber() and call a function to stop AddNumber from running after creaetNumber() is finished? i just want my program to sit there to wait for an event to happen.
View 1 Replies
Feb 5, 2012
I am trying to access a datatable created at form load from a sub created for a button click. I get the message 'dt_ShoppingBasket' is not declared for the following 2 lines.[code]If I move the creation of the Datatable into the button click sub then the problem goes away. I've listed the relevent coding I am using below.[code]
View 3 Replies
Jan 31, 2012
I'm working with a third-party library interfacing to an old database system. There's a method - CallProg that calls a "stored procedure" (for lack of a better translation - any Pick users in the crowd?). However, instead of doing something like this:
Public Sub CallProg(ProgName, ParamArray ProgArgs() As String)
...
End Sub
[code].....
View 2 Replies
Sep 9, 2009
I have a page where the page loads with the code as shown below. Pretty much every other sub on the page uses the variables gFilename, gPicType and gPicPath. In every other routine I have to go through the process of recreating gPicPath (as per the if/then block in the code). How do I create these variables ONCE, and then store them so that all the other subs can access them?
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
' check to see if this is the first time the page is loaded.
If IsPostBack = False Then
[code]....
View 7 Replies
Nov 14, 2009
Using Visual Studio 2008 I am trying to create two subs using the same handles:
Private Sub checkwin(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click, Button2.Click, Button3.Click, Button4.Click, Button5.Click, Button6.Click, Button7.Click, Button8.Click, Button9.Click
[Code].....
As these both use the same handles one sub overwrites the other...... Both subs contain If statements. Do I need to create two different handles... and how do I do this so that the handles use the same buttons?
View 3 Replies
Jun 14, 2009
I don't mean to sound unintelligent, but is there a way to insert your functions and subs into visual basic and call them from and program made in visual basic? I don't want to have to put the code in over and over again.
View 8 Replies
May 21, 2009
I was wondering how to implement a vb script file with functions and subs that can be used in all code pages of a project. Similar to the old VB 6 bas files.
View 2 Replies
Apr 7, 2009
Option Explicit On
Option Strict On
Public Class frmMain
Private Sub btnSub_Click(ByVal sender As Object, _
ByVal e As EventArgs) Handles btnSub.Click
Call CalcSumSub(CLng(txtN.Text))
[Code] .....
I'm not receiving any errors or any thing I just need figuring out the logic in this program. The Program Needs to Accept Input in One text box and adds n numbers together and displays the sum using only subroutines and Functions.
Attached File(s)
Assignment5.txt (4.49K)
Number of downloads: 84
View 4 Replies
Oct 10, 2010
Trying to learn subs at the moment.I need to take the following code and rewrite it into subs.
Private Sub btnCompute_Click(...) Handles btnCompute.Click
'Convert feet and inches to centimeters
Dim str As String[code]....
View 14 Replies
Mar 18, 2009
I am trying to combine two subs into one and then find out what control is calling the sub using .GetType. I have tried to do this using a select case and wasnt able to. Any ideas. These are the two subs I am trying to combine into one:
[code]...
and couldnt get the .SelectAll to come up in Intellisense
View 2 Replies
Jan 7, 2010
I have an access database for steel members. Each table has a different type of member, and then in those tables, each size of that member type.
I am about to create a tool that draws these sections when they are selected, but as there are 12 different member types, I don't really want to have 12 different Subs for "Draw" that essentially do the same thing.
I considered polymorphism.. (I think I have it correct)
[code...]
View 1 Replies
Sep 2, 2009
I'm having an issue where I need to pass the value in a variable from one sub to anotherHere is the scenario. I have two forms; Main_Form and frmClient. I take a value from frmClient and pass it into a sub called Form_Activate located in Main_Form. I then need to take the value from Form_Activate and use it in a sub called when the user selects a menu item in the toolstrip.Starting point is frmClient and the code there is this:
Private Sub Button1_Click(ByVal sender as System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Client As Integer
[code].....
View 9 Replies