Forms :: Store The Reference Passed To A Sub?

Aug 6, 2010

I've searched a lot on both google and here but sorry, couldn't find.Maybe I'm just asking the wrong question, so I'll try to explain it here to see if someone can help me:

what I'm trying to do is what in C would be as simple as int varptr = &var I have a form that is just a communication watcher/logger. It's just a blank text box with a Pause/Play button and a copy to clipboard button and every new activity on my serial communication is logged. At the moment the form have a timer that once a second do textbox.text = serial1.log ...

but the problem is that I also have serial2; serial3; sql1 that I would like to keep an eye on them, and considering my work here I'm sure I would be re-using this form a lot if I could make it portable. Create one form for each is just stupid, as you'll all agree.

Then I would like to have an sub initialise(byref log as string) that would store this reference into an local variable within the form; so that every new instance of my form could be initialised with whatever log they'll be looking for and the timer just make textbox.text = LogPointer to the actual value of the log string.So, as I said I really wanted a int varptr = &var

View 4 Replies


ADVERTISEMENT

Variable Passed By Reference?

Oct 28, 2011

I am working on a little program (game) is called Pig latin. I created a sub procedure and I passed the word to be converted by value and the piglatin word byref.Now when I call the procedure in the button click event I get the wavy green line under the variable passed by reference but the program works ok. Call Convert_to_Pig_Latin(strOriginalWord, trPigLatinThe error message when I hover my mouse over the green line says " Variable strPigLatin' is passed by reference before it has been assigned a value. A null reference exception could result at runtime."

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

[code].....

View 4 Replies

Variable Is Passed By Reference Before It Has Been Assigned A Value

Jul 7, 2008

Im getting the Variable (Data) is passed by reference before it has been assigned a value error.

[Code].....

View 3 Replies

Controlling Multiple Textboxes From Single Function - Passed In By Reference?

May 1, 2011

Is there a way to write a single function that will control validating the input to any textbox? How to pass control of it.

E.g.: My second try was to:
Dim CurrentTextBox As TextBox << Declare a global
Write a function that uses the global textbox and takes in 2 parameters, one determining the length it has to validate and the second telling it what to do once the input is verified

Public Sub ConfirmInput(length As Integer, which As Integer)
If (CurrentTextBox.TextLength < length) Then
CurrentTextBox.BackColor = vbRed
GoTo DONE
ElseIf (CurrentTextBox.TextLength > length) Then
CurrentTextBox.BackColor = vbRed
[Code] .....

My first try was to pass a textBox parameter to the ConfirmInput function but I believe that's the same problem as above.

View 4 Replies

Function Accessed By Multiple Threads With Parameter Passed By Reference

Apr 29, 2011

I am in vb.net and have a function that will be accessed by multiple threads. Everything inside the function uses local variables. However, each thread will pass in its own dataset by reference. From what I have read the local variables should be no problem, but I think the dataset coming in is a concern. How should I control access / execution of this function to make sure that it is thread safe?

View 1 Replies

ClientID Not Being Passed Through Forms Correctly

Dec 21, 2011

I've got three forms, one is a search form where you use textboxes to filter the datagridview to find the Client you wish to work on.The second form is basic data entry, their personal details, assets, liabilities, etc is entered on this form.The third form calculates all sorts of reports about the particular client.I filter the binding sources each time to get the appropriate clients data on the form when the particular client is chosen in the first form.When I go to print the word document I create at the button.click event, it comes up with an error saying "Conversion from string "" to type 'Integer' is not valid. I've checked countless times, tabbed in and out of the textbox, named ClientIDTextbox, but it still wont accept that there is a value in that textbox - the error is appearing on the line where I use the textbox to query data from the database using the ID in the textbox.The third form holds the print button, and the second form holds the ClientIDTextbox which is causing this error.

I'm about to try querying the binding source, instead of applying a filter, using ClientBindingSource.DataSource = dt where dt is a datatable. I'll let you know how this goes! But in the meantime, is it because I've filtered the binding source multiple times across forms that the error is appearing?

View 3 Replies

Forms :: Add The Argument For The ID In The Labels Tag To Be Passed To This Sub?

Feb 9, 2011

I have created a control, similar to an image combo, but a bit different. Any how, each of the labels that contians text to be clicked has an ID in their tag, that i wish to read. I have a sub routine called CBO_Click() which has the same arguments as a normal label click. How can i add the argument for the ID in the labels tag to be passed to this sub.

View 2 Replies

Reference To The String In The Heap Is Passed Even When You Pass The String ByVal To A Method?

Mar 2, 2011

So strings are reference types right? My understanding is a reference to the string in the heap is passed even when you pass the string ByVal to a method.

String myTestValue = "NotModified";
TestMethod(myTestValue);
System.Diagnostics.Debug.Write(myTestValue); /* myTestValue = "NotModified" WTF? *[code].....

And what is going on under the hood? I would have bet my life that the value would have changed....

View 5 Replies

Can A Generic List Of T Be Passed To Function Similar To Way An Array Is Passed?

Mar 23, 2012

I want to pass a List of T where T is an object I've created that has about ten properties (strings, dates and integers).The lst passes to the function successfully. I am also passing an New T of the Object (itm as T).I can see all the values (see image below), but because it's generic I cannot seem to retrieve the property values and I cannot figure out how to iterate through the properties of each itm as they are retrieved in the For Each.[code]

View 10 Replies

Creating Multiple Forms At Run-time - With Variables Passed To Form

Oct 4, 2011

I'm making a IM LAN Chat, and I don't want to limit it to a specific number of chats that can be open at any given time (By re-producing the forms and setting variables once a chat is open).

[Code]...

View 4 Replies

.net - Variable 'cl' Is Passed By Reference Before It Has Been Assigned A Value For DataView Variable?

Feb 1, 2012

I have the following code passing a dataView variable to a function and I am getting the following warning:"Variable 'cl' is passed by reference before it has been assigned a value. A null reference exception could result at runtime."

Function Editclass()
Dim cl As DataView
Bindclass (SqlConnection2, cl)

[code].....

View 1 Replies

.net Store Reference Of Variable In Another Class?

Dec 25, 2011

Class1:

Dim v as integer
public sub storeVar(byval s as integer)
v = s
end sub

[code].....

I need to save a reference of variable s in Class2 in variable v in Class1.(i.e. when the value of s changes v also changes (and vice versa)Is this possible since vb.net doesn't have pointers?Will it work if I change "byval" to "byref"?

View 1 Replies

[2008] Null Reference Error - Store Values In Arraylist Permanently

Jan 22, 2009

I have a module and form. Module has a structure.

[Code]...

Actually values are not stored in that array list permanently. its storing temporarily and then destroying. i want to store that values in that arraylist permanently.

View 28 Replies

InputBox Function - Program - Allow User To Input 5 Payrolls For Store 1, Store 2, And Store 3

Mar 22, 2012

I am coding a program that will allow the user to input 5 payrolls for Store 1, Store 2, and Store 3. The total of the 5 payrolls are then added together and shown in the respective Store's labels. A total label is also there to add up all the totals into one number. The numbers in the label must be in currency form. My problem is the numbers don't add correctly when I hit calculate. The first two numbers add together, but then after that the number just seems to subtract a random amount.

So far I have this --

Public Class Form1

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Close()
End Sub

[CODE[...

View 14 Replies

Forms :: Store Image In SQL?

Dec 25, 2009

I have loaded a picture in PICTUREBOX1 by this command

Me.PictureBox1.Image = Drawing.Image.FromFile("D:C2007BITMAPSpict.jpg" )

How to store this picture SQL server 2005 table1's IMAGE column?

I do not want to store image path in table. I want to store picture in image column in any format.

Reason: If I run my project to some other computer that has not images'path stored in database. Then images will be displayed by image field of database.

Table1 has following two columns
student_no int
student_pictimage

View 1 Replies

Forms :: Store Image In SQL Database

Dec 22, 2009

Table "employees" has four fields as
sno---name---city-----photo
1------a-----london----
2------b----Tehran----
3------c-----dublin----

I use following codes to pickup employees pictures, How to store photos into table "employees" column photo.

Dim OpenFileDialog1 As New System.Windows.Forms.OpenFileDialog
Dim pic As Image
Dim retVal As DialogResult

[Code].....

View 3 Replies

Forms :: Where Is The Best Place To Store Messages

Aug 14, 2010

I am wondering where should I store my error messages. These messages are the simplified version meant for the users. I am thinking like centralizing a specific location to store all the custom messages so that it will be easier to reference in the future. The location should also provide a key for each stored message.

[Code]...

View 5 Replies

Store Data From User Forms?

Sep 17, 2011

I would like to develop a program to create a report after reviewing a facility's processes (Quality Issues). The reports are to be created using Microsoft Word 2010.

I'm OK with developing the forms and controls to access the form and the user inputs.

What I need guidance on is the best way to save the input information from the user forms (over 100 total) as it relates to that facility, and to retrieve the info in case clarification is needed. Also, each user may have several facilities to review.

View 5 Replies

Store Variable Values Between Forms?

Jul 12, 2010

My application sends information from Form1 to Form2 by means of a global variable on Form1 whose value is read by Form2.

This variable is basically used to tell Form2 what it has to do because it's value will change depending on different conditions.

All form2 is meant to do is load data from a database into DataSets which will "ported" to Form1 (the main form) for consumption. I use a Form for this rather than a class because there's a lot of data that will be loaded each time it's visible and I wanted[code]...

View 6 Replies

Where Do ASP.NET "website Prejects" Store Default Reference/assembly Settings For VB/C#

Jul 22, 2010

MY understanding is like this, for the "website type" of projects:for VB, the default setting for the namespaces and the default setting for references are both stored in C:WindowsMicrosoft.NetFrameworkV4.0.30319ConfigWeb.config.

but C# does not seem to use this global web.config file to store its default namespaces and references settings. One evidence is that you see a lot of "using ..." statements at the top of all C# files whereas you don't see many "imports ..." statements at the top of all VB files. So C# stores the namespace settings in individual .cs files, but where does C# store the reference settings then? Or the C# compiler knows all the reference without having to store it somewhere?

View 1 Replies

Forms :: Object Reference And Cloning?

Sep 14, 2011

I have a form that accepts a byval client object in the New

private _client as clsClient = Nothing
Public Sub New(ByVal client As clsClient)
InitializeComponent()[code]....

On the calling form I have labels bound to the properties of the _client object, like first and last name.On frmEditClient if have textboxes bound to the same fields.What is happening that I don't understand is that when I'm showing the frmEditClient as a modal window of the calling form, when I change the first name, for example, the labels bound to those fields on the calling form are also changed as I type, indicating that they both point to the same object.

Now this is rather cool, but I expected the object to copied and a new instance to exist in the frmClient modal form, but obviously it is the same instance.Is this because the object is a reference type and so by specifying byval in the frmEditClient creator has the same effect as passing byref? I wanted a separate object in case the user edited the object in frmEditClient and then decided to hit the cancel button and not commit the changes. In this case, do I need to clone the client object before I send it to the frmEditClient?

Like this:

dim _cloneOfClient as clsClient = _client.Clone
Dim f As New frmEditClient(_cloneOfClient)
If f.ShowDialog() - DialogResult.OK Then
_client = f.Client
End If

Problem: There is no clone method. How do I get a copy of an object that is a new object?Or is there a better way to do what I'm trying to do?

View 2 Replies

Forms :: Reference Form Using Variable

Aug 18, 2010

I have an application consisting of 2 forms (Form1 and Form2).There is a text box on each form and they are both named Text1.From a sub routine in a module, I want to alter a text box on one of the forms. The sub determines which form to write to and attempts to refer to the form using a variable.But in the example below, gForm never gets declared when it's nested within the If statement.[code]The actual application is not so simple and I need to use this or a similar approach throughout the application in order to reduce code redundancy.To recap, I want to alter a control on a form by replacing the form name with a variable name. [code]

View 4 Replies

Forms :: Reference Text Controls In Other Tabs

Sep 2, 2011

i am building a tab control (using VS 2010 and 4.0 framework). on Tab 0, this works as expected:

Me.ddUE_B1.SelectedValue = Me.B1.Text <-- changes the combo box selection to what is in the label.

on the other tabs this does not work. when I do a messagebox to show, say, Me.Ea1.Text on Tab 1, nothing is returned.

Is there an issue with referencing controls on tabs that I am missing? In general, I will need to set combo box's value to what is in the database when the form loads.

View 3 Replies

IDE :: Add A Reference To PresentationCore.dll In A Windows Forms Application

Jan 18, 2010

Using: Visual Studio 2008 Professional

I created a new project of type Windows Forms Application. And following a few posts elsewhere in order to implement spell checking on my application I attempting to add references to: PresentationCore.dll, PresentationFramework.dll, WindowsBase.dll, WindowsFormsIntegration.dll

BUT... when i go to add then they're grayed out and unselectable.

Can someone tell me why (i can't add the refs) and what I need to do to implement spell checking in a windows app?

Late Addition: I started out by copying the DLLs into the bin (after searching vs & .net installation folders) of a VS2005 project and that worked. I guess I can do the same here but I figure VS2008 should have this built in and I SHOULDN'T need to use the method.

View 5 Replies

Designer Can't Load Reference 'Microsoft.WindowsCE.Forms'?

Jan 28, 2011

If I add an InputPanel control on B, i have no problem.If I add an InputPanel control on A and B, i have no problem.But if I add an InputPanel control only on A, I'm unable to open the designer for form B.

The erros is :
Could not load file or assembly
'Microsoft.WindowsCE.Forms,

[code].....

View 1 Replies

Forms :: Class Library Reference Disappearing Upon Compiling?

Dec 30, 2011

I have a solution built of 3 projects:

1. VB.NET Class Library - data access and objects, reusable methods, etc.

2. ASP.NET Web app - web application that references the class library

3. VB.NET Windows Form app - windows app that references the class library

I have no problems with the web app. It referenes the class library and every time the project is built the web app gets a freshly compiled dll from the class library.

My problem is with the windows form app. When I first add the reference to the class library project, I get all of the intellisense I'd expect while coding. When I try to compile, though, it's like the reference disappears and all my code that is based on the class library errors out with "'xxx' is not declared" or "'xxx' is not defined" where 'xxx' is a method or class within the class library. If I go into the project properties, the reference is still there, but the project no longer compiles and I also lose intellisense for all classes within the class library. If I remove and re-add the reference, it works again, until I try to compile. Then the errors occur again.

I've tried creating a separate Windows Forms project and just referencing the DLL created by the class library but get the same problem. HOWEVER, if I create a seperate blank WEB project and reference the dll (or the project), everything compiles fine. It seems to be something with my class library being referenced by a windows forms app.

For reference purposes, my class library has the following references:system, system.cor, system.data, system.data.datasetextensions, system.drawing, system.web, system.xml, system.xml.linq I noticed I can't add a reference to System.Web in my windows forms app, and I wonder if my problem is somewhere in this area. I need the reference is my class library because it passes some HttpContext objects back and forth to a few of the methods.

View 1 Replies

VS 2008 Array Reference - Project With Several Forms And Modules

Dec 9, 2009

I have a project with several forms and modules. The problem which I am mentioning revolves around 3 items : 2 forms (e.g. form1 & form2) and a module. (Using VB.NET 2008, .net 3.5)

Now I have a structure declared in a module. I have a variable of that in form1 and form2.

'Module Code

Structure MScanner
Dim Indicator() As MuseIndStru
Dim FName As String

[CODE]..............

Now what is happening is, I am passing structure variable MScan (Form1) to Form2 (see function of form2 InitFilter) byvalue. Then in form2 I am changing value of a copy of the structure (see variable MS being changed in a private sub). But then when I close form2, form1's variable of MScan also get the value of variable MS (declared in form2).

I don't understand as this is not suppose to happen. I have reloaded my project as well but this problem is there. Why is my form1's variable value MScan being changed by form2.

View 4 Replies

Forms :: Selecting Datagridview Cell Data In Reference To Row Index

Aug 6, 2011

I've been looking everywhere for an answer to a simple question, but i'm having issues, so i thought i'd join and post here. I'm having issues with a simple concept. I load information from a SQL database, and i want to add a 'Passport' link URL relating to column cells called 'name'. It basically selects the name, and inserts it into the link fields to be opened. But i cant find a way to work it. I thought i could do it with something like:

[Code]...

View 1 Replies

Using System.Windows.Forms.TabPage To Store An Entire TabPage For Later Use?

Jan 8, 2009

I am using System.Windows.Forms.TabPage to store an entire TabPage for later use in My.Settings. Here is a brief description of the application.

I have a TabControl that has 3 tabs. One for user input, another tab for equipment settings, and then a final tab for Oven settings. On the user input tab, if the user de-selects the checkbox for Oven, the oven tab is saved to My.Settings and hidden.

I can then run the application without oven control. After running, lets say the user would like to re-run, this time with the oven. They go back to the input tab and re-select the Oven checkbox. However, the Oven tab doesn't re-appear. When stepping through the code, the is nothing stored in My.Settings for the oven tab page. Why not?

Also, I can open the application, and check, then uncheck the oven checkbox and the tab is hidden, then returns. I can do this all day. However, after running the tab will not return.

View 5 Replies

Store Whole Numbers And That A String Is A Varialbe Used To Store Any Text?

Feb 19, 2009

i know that integer is a variable to store whole numbers and that a string is a varialbe used to store any text, but what variable type would you use to store a number that has decimals?

View 7 Replies







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