VS 2005 - Combine Two Subs Into One
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
ADVERTISEMENT
Apr 14, 2009
I've searched these forums, and found some GDI and C# links, but I really want to do some image processing in VB.NET.
how I would go about combining 2 bitmaps into one, sort of superimposed on top of eachother? I don't know what libraries are available in .NET.
View 13 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
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
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
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
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
Jun 22, 2010
I'm writing a program that gathers a list of files within a directory and optionally, every file within the subdirectories (10 levels deep) of the directory then exports it as a text file. I have no idea how to do this so I just attempted to code it myself.
It works by gathering a list of every subdirectory within the selected directory and their subdirectories, so on and so on and adds them to a listbox. Then to gather the list of files I used a for each to get the files within the subdirectories but it shows "(Collection)". After exporting it shows " System.Collections.ObjectModel.ReadOnlyCollection`1[System.String]".
How can I make this code work? I think I could've done this much easier a different way but I need the full path included.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
ListBox1.Items.Clear()
Dim FolderBrowserDialog1 As New FolderBrowserDialog
[code]....
View 1 Replies
Jun 2, 2011
Earlier I was working on a project, and I added a StatusToolStrip and the the ToolStrip I added a label and a progress bar. The label will say the current sub or function that is in progress and the progress bar will show how far along it is through the sub or function. I have tried this myself but I cannot figure it out as I rarely use progress bars.
An example of a code that I would like the progress bar to show would be like this:
Private Sub StopServer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StopServer.Click
'Checks to give server notice
If My.Settings.warningmessages = True Then
Dim cmd As String = My.Settings.warningmessagetext(2)
[Code] .....
So while the sub is running the label would say "Stopping Server" and the progress bar would show how far along the sub is.
View 4 Replies
Feb 26, 2011
I've been wondering if there is anyway to extend a sub of a base class in a derived class or subclass. To date, the only thing I've been able to find is overrides and overloads functions, but to my understanding these functions just ignore your base class's sub and just allows you to run the new one with the same name.
What I want to be able to do is:
CODE:
I'm not sure whether this is possible, or if I'd simply either make a new sub in my derived class that first ran the base's class sub or whether I'd override the base class and then copy and paste the old code.
View 6 Replies
Sep 1, 2010
I have 5 different subs for importing data into SQL Server 2005, 4 of them rely on a namespace that is listed at the top of the class, and 1 that will not run if that namespace is uncommented. There has got to be some way to run all five of these subs however i'm have a hard time figuring out how to get everything to mesh. So I figured I'd ask and see if someone had any ideas or could point out my mistake.
Imports System
Imports System.Net
Imports System.Web
Imports System.Security.Cryptography.X509Certificates
Imports System.IO
[Code]...
View 7 Replies
Oct 4, 2008
This is very basic about the layout of classes, subs etc. 1. Should all my subs & functions always be inside a class? I haven't used classes too much before, mostly just a bunch of subs in a form file. Now I downloaded a sample program which I want to develop. This has all the code of the form inside "Public Class Form1": [Code] The code is an example of use of the ZedGraph library. It produce a simple window with one graph/chart. Now I want to develop this code with several tabs, a dusin different charts, file I/O and so on. I'm ok with most of the specific coding, but my question is on the general coding;
2. Should I continue my subs&functions inside this form? inside this class? inside a new class? Earlier when I've NOT been using class, I can make global variables by placing the "Dim" outside the subs. This does not seem to work within a class. 3. Should I avoid global variables all together, or how is this done without always passing arguments?
Also I will make more forms, for program options etc. 4. Should these forms be coded as classes? or just subs&functions in a form? Obviously I'm not well trained on the proper use of classes and have trouble to find this easily explained.
View 2 Replies
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
Apr 10, 2011
I want to create constructor that can create container with these properties:
1. Only Diameter, in new sub define it round shape.
2. Diameter and Volume.
3. Length and Width (for rectangle shape)
All are double data type, but problem is 2 and 3 are conflict.How to let program know I want to create round shape container or rectangular shape container?
[Code]...
View 16 Replies
Nov 5, 2010
Probably an easy question to answer...I have 9 buttons on my form
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
etc. and all do the same thing so how can I merge them into the same sub so i don't have to copy and paste a bunch?
View 4 Replies