Passing User Object Between Forms?

Mar 6, 2011

I am having some difficulty getting my head around passing objects between forms and hoped someone might put me on the right track... I have five forms: frmMain, frmLogin, rmAdminMode, frmUserMode, frmUserMode, frmUserModeDeepThere are two main use-cases: admin mode and user mode.Admin Mode: As the project starts it runs frmMain. Clicking a button stops the autologin (simple timer) and will invoke frmLogin (using .ShowDialog). The user is prompted for the users' ID number (four digits) and pass-code (again four digits).frmLogin will query a back-end database to authorise or reject the login attempt (this bit is all working fine) and then return control to frmMain. If the user is a valid admin frmMain will then invoke frmAdminMode.

frmMain -> frmLogin
<- frmLogin
-> frmAdminMode

[code]......

View 8 Replies


ADVERTISEMENT

Passing User Object To Remote Server

Oct 9, 2011

I want to make a button like this:The first image is a normal button, but the second is a button with mouseEnter event fired. The bottom part of the button in the second image is not clickable and it acts like a tool tip. How can I make this kind of a button? Do I need to use a tool tip? Please give me some code examples.

EDIT:Here's F Ruffel's code which I modified:

[code]...

Now the last problem is: the expanded part pushes all controls down, and that's what I don't want. Please modify this code to make the extended part overlay controls that are below it, just like in the image.

View 4 Replies

Passing User Object To Remote Server?

Oct 7, 2010

My project uses .NET remoting. The client connects to the server hosted in IIS to do database operations.

We have a class library that is referenced both by the client and the server. This contains basic static (shared) functions used throughout the project. An example would be a function that takes a customer/invoice number and pads it with zeros/spaces to our desired format. This works fine. There is a copy of the dll with the client and on the server in the IIS virtual directory. Both the server and the client can call these functions and they work correctly.

Now, in that same class library, I've defined two things: an enumeration (enum) and a serializable class. If I try to call a function on the server from the client that passes/returns an instance of either the enumeration or the class, I get the following

[Code]...

View 2 Replies

Using Multiple Forms In A User Control And Passing Values Between Them?

Feb 6, 2012

I need a nudge in the right direction. I have a user control that has the main form and it calls a secondary form to gather some additional information in some cases. I need to pass the information back from the secondary form to the primary user control form so I can validate the data and save. In the secondary form, I have the following code:

Dim myFrm as new frmOperationComments
myFrm.OperationComments = [comments from form]
myFrm.OperationDate=[Date from form]

I have tried creating two public properties on the user control and setting them, I have created two properties in the user control form called OperationComments and OperationDate. I can set both of them, but when I close or hide the form and go back to the main user control form, the values for these properties or variables are not set. How do you set the values on the main form from a calling form within a user control?

View 2 Replies

Forms :: User Define Sub - Move To Next Object

Jul 18, 2010

I've created a private sub which enables me to move to the next object when I press enter in the textbox or any input controls... What I want to do is to create a universal sub procedure for moving to next object. this is my code

[Code]...

View 1 Replies

Passing A JSON Object As A Dictionary(Of String, Object) To WCF Web Service?

Sep 8, 2011

I'm trying to setup a WCF web service to be consumed by JavaScript using JSON and jQuery.I've noticed that you can send JSON without a DataContract if the service method parameters match the naming structure of the JSON object:

<ServiceContract(Namespace:="http://foo.com/bar")>
<AspNetCompatibilityRequirements(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allowed)>

[code]....

View 1 Replies

Passing Null Object() ByRef Returns Initialized Object()?

Dec 8, 2009

I am making use of a 3rd party dll and am encountering some strange behavior in VB, which doesn't occur in C# Perhaps someone can explain what is going on. Anyhow, I am making use of a method in this 3rd party library which accepts an array parameter ByRef. The end result is the variable should remain null after the method call, but it is returning initialized for some reason.

[Code]...

View 2 Replies

Passing Values From Datagridview Object Reference Not Set To Instance Of Object

Apr 26, 2010

I'm having a problem with passing on values from my data grid view to a textbox located in another form.[code]

View 2 Replies

Passing Data Between Forms Without Any Public Methods Or Properties On The Forms

Dec 28, 2009

Passing data between forms without any public methods or properties on the forms. everything but the "Controller" class, which I would like you furnish. I just changed the title from "Intermediate" to "Beginner" This solution is an example of the Observer Pattern. The "Controller" class is the "observed" class, which in this case means it publishes events.

' File Definitions.vb

Public Delegate Sub MessageDelegate(ByVal sender As Object, ByVal e As MessageEventArgs)

Public Class MessageEventArgs : Inherits EventArgs
Public Message As String

[CODE]...

The program should initially display Form1, and Form2. Clicking of the button on either form will modify the Title Text of both forms. I think that you will find the final end result to be pretty neat, as it works with any number of open forms not just two. I think asking for the Controller class is easier than asking for the code in the forms. My solution for Controller class has 7 lines of content, 9 lines if you include Class, EndClass. A minimal solution could achieved with only 4 lines of content, but it would a textbook example of bad programming.

View 12 Replies

Forms :: Passing Several Textbox.text Between Forms

Jul 28, 2010

I use the code

Dim Selvk As New Selvkost2
Selvk.PassedText = TextBox29.Text
Selvk.Show()

[code]....

in my second form and the text passes. but I need to pass values from 20 textboxes. do I have to copy the code in my second form 20 times an declare passedtext2 and so on or is there an easier way to do this?

View 3 Replies

Forms :: Wonky Variable Passing In Forms

Apr 22, 2010

This is my first Windows app to create since VB6. I've been in the world of ASP and ASP.NET for many years. However, now I have been asked to create a simple app that needs to be windows based.

[Code]...

View 4 Replies

Forms :: MDI Forms And Passing Information

Dec 17, 2010

Example Form1 with data bound controls and a Public Variable Form1Var.Form2 with data bound controls and a Public Variable Form2Var DataTables are related Form2 Data is related to Form1 Data in a one-to-many.What I am trying to accomplish.When editing Form1 data there is a button to open Form2 if new data needs to be added. on closing Form2 I would like Form1 to remain at the state it was in before opening Form2. If I Change Visibility of Form1 when Form2 is opened upon Retun to Form1 Data is reloaded, if I minimise Form1 when Form2 is opened upon return to Form1 Public variables are reset to defaults.I have many Forms with many controls and buttons to do Lookups or additional add to related tables.

View 2 Replies

Forms :: Passing Data Between Forms?

Nov 12, 2009

I have a gridview on a form pulling user data. I have also created a basic login system where users login and their username/password is checked against a table in SQL Server 2005.The gridview is on Form 2 but i am having great difficulty in returning the records in the gridview for the user that is currently logged in.

View 3 Replies

Forms :: Passing Information Between Forms

Aug 21, 2011

I'm getting a little fustrated, ive been trying to figure out how to allow my main from access to a sub form. what I'm initially aiming for is control of text and font color via a dialog on the main form and the results to appear on the second form, if that makes sense. Most of my knowlege resides around using VB.net for creating games and not progams. ill post the code so you guys might be able to get a better understanding of what im looking for as a result.

[Code]...

View 2 Replies

Forms :: Passing Values Between Forms

Jul 23, 2009

My scenerio is a form with a button, when clicked opens a form dialog. The dialog allows the user to enter a text box. I want to read the value of the text box from the main form into a variable to be used with an SQL statement. The following code is used to create a new instance of the form dialog if one does not exist:-

[Code]...

View 2 Replies

Forms :: Passing Variables Between Forms

Nov 27, 2009

I seem to be running into an issue. This may seem like a noob question (which it really is, I only have experience in vb6 from years ago) but what Im trying to do is pass a variable from one form to another. Ive tried telling the first form to set the value of the variable on the second form like so frmsecond.variable = "value" but that does not work. Ive tried placing a public variable in a module to do it, but again, no luck. The only way seem to be able to get it to work is the second form setting the variable by reading the value from the first form like so [code]The problem I have with that code is what if for some reason the selected line gets changed as the form is loading or something to that nature. It doesnt seem very secure.

View 5 Replies

.NET: Passing Self To A Child Object?

Nov 8, 2011

I occasionally find myself passing this or Me to a child object. Such as this condensed real-world example...

Public Class Entity
Private mValidator as New EntityValidator()
Readonly Property IsValid()[code]....

I'm concerned about .Validate(Me).I get no warnings or Code Analysis violations, but it just feels wrong. I get nervous about infinite recursion and garbage collection.

View 2 Replies

Passing An Object From Its Own Class

Jul 4, 2011

In a VB 2010 program we have two classes Aclass and Bclass.In Bclass we need all values of an Aobject.How could we pass the Aobject to Bobject?[code]Is there any VB entity that could be defined as including all the properties of a given class?

View 3 Replies

Passing Object (Name Of Property)?

Jul 10, 2010

I am creating a procedure and would like to know if I can pass the name of a property. I.e ComboBox1 so I can change the properties of that object. What I have done is create a procedure to populate a Combobox from my MySQL database. What I want to do now is populate the relevant Comboboxes without having to create a new procedure specifically for each combobox. I can create a procedure for each Combobox but the whole reason for procedures and functions are to minimize repetitive code and to make code easier to manage.

At the moment my procedure is ProcedureName(ComboBox1, "DatabaseName", "DatabaseField").

What I want to be able to do is do
ProcedureName(ComboBox1, "DatabaseName", "DatabaseField1").
ProcedureName(ComboBox2, "DatabaseName", "DatabaseField2").
ProcedureName(ComboBox3, "DatabaseName", "DatabaseField3").

View 5 Replies

Passing An Object (Text Box) To Sub Procedure?

Jan 19, 2011

I need to write a procedure which will allow me to set readonly attributes for certain objects, for example:My form contains two text boxes box1, box2.My sub procecdure will contain code which sets box1.readonly() = true, but i dont want to name the "box1" in the sub procedure but pass it as a parameter....I thought this could be achieved using :

private sub disableobject(byval inobject as system.object)
inobject.readonly() = true
end sub

View 7 Replies

Object Creating Code & Passing Values To SR?

Mar 29, 2011

This code works, as is, on my system. Problem lines are commented out. The last three commented lines are the problem.It creates the objects alright but a line that should send a message into the list box doesn't work. I am almost sure that the problem is in passing information into the sub routine. Forgive my use of ALL CAPS as it helps to see my comments on comments. A few comments in passing information to SRs would be helpful.

Also, how it is that I can comment out the .Name option and it still works?(I hope that this shows up properly. If it ends up as a big useless paragraph, I will repost it after learning how to do it properly.

Here is my

Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' -------------------------Create ann exit Button -----------------------------------------------------
Dim btn As New Button

[code]....

View 11 Replies

Passing Base Object Type When Using Inherited One?

Oct 8, 2010

I have a project that has mainly two objects, both inheriting from a base. Like this:

Public Class Vehicle
Property Model As String
Property Make As String[code].....

The above function doesn't work because myVehicle is a Vehicle, not a Truck.Is there a way I can pass around a Vehicle type and have the IDE know which type to use? Or am I completely missing a better way to do this?

View 5 Replies

VS 2008 - Passing A Object Data To A Class?

Oct 5, 2010

I've got a main form (Form1.vb) where I created some controls (with the Designer).I've created a class myTextBox, inheriting from TextBox, in myTextBox.vb.In the main form, I call procedures from myTextBox. The issue is, those procedures use values from the Form controls. So the class doesn't recognise them as initialised.What's the best solution for this?I think I could pass the object itself as a parameter but doing it on each call seems a bitredundant and it thickens the code.Is there any way to access the Form1 controls and objects directly from the myTextBox.vb class?

View 6 Replies

Object Reference Not Set To An Instance Of An Object When Searching For User In Active Directory?

May 8, 2012

I tryed searching for an user in active directory using the code below but it gives me the error in the title of this post above:

AD = New DirectoryEntry("LDAP://OU=SchoolOUhere,OU=Staff,DC=garrard,DC=ketsds,DC=net", "", "", AuthenticationTypes.Secure)
AD2 = New DirectoryEntry("LDAP://OU=_Groups,OU=Staff,DC=garrard,DC=ketsds,DC=net", "", "", AuthenticationTypes.Secure)

[Code]...

Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth. - "Sherlock holmes" "speak softly and carry a big stick" - theodore roosevelt. Fear leads to anger, anger leads to hate, hate leads to[URL]...

View 4 Replies

Wpf - Object Reference Not Set To An Instance Of An Object When Using Custom User Control

Feb 10, 2012

I have created a custom user control (JCUserControl), and I am using it in the Main Window. And my Main Window has no codebehind. I have this in the JCUserControl codebehind:

Private Sub ImmediateRadioButton_Checked(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles ImmediateRadioButton.Checked
SomeTextBox.IsEnabled = False
End Sub

When I run it, it fails with the NullReferenceException. If I comment out the SomeTextBox.IsEnabled = false, it runs without any problems.

Edit: Found out that I could just check if the radio buttons are loaded before doing whatever I want to do.

Private Sub ImmediateRadioButton_Checked(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles ImmediateRadioButton.Checked
If ImmediateRadioButton.IsLoaded Then
SomeTextBox.IsEnabled = False
End If
End Sub

View 1 Replies

Handle An Object's Object Property Changed Event In .NET Windows Forms?

Jun 7, 2012

I know how to handle a single objects property changed event very easily. I want to handle a objects property changed event that is part of another object.

Given Object:

[ObjectY = Y]
+ Public WithEvents X As ObjectX

I would like to do something like:

Private Sub XPropertyChanged() Handles Y.X.PropertyChanged

Right now I need to create a object that equals the object inside that object and then handle this variable pointers property changed, but that is just annoying.

View 1 Replies

Passing In User Settings

Sep 15, 2010

I have an application that uses user settings and I have a button that gets a value (long) and writes this in a textbox I then have a setting called StoredKey with the data type of long I then pass this to the setting like this:my.settings.StoredKey=cLng(textbox1.text)this all works well in debug, but when I deploy my application and try to store the value in my.settings.StoredKey the value never gets written in!by deploy I mean packaging the exe in a setup and deployment project type and performing the wizard install to c:program files.[code]

View 1 Replies

Passing Parameters And Bug In The .Com Object For Making A Desktop Shortcut

Feb 9, 2011

Here's the code that is causing my problem, I have no idea why though. All necessary services have been imported.

'Creates Prompt File
Sub CreateFile()
Dim createstring As String = ""

[Code].....

View 2 Replies

VS 2008 : Passing MySQL Parameter As Object Instead Of DateTime?

Jun 13, 2011

I am having trouble with a mySQL query with the .NET connector. When I create the query, it automatically creates my parameters as objects. I usually change the type to the correct type, which in this case is Date, but I get different results passing in the parameter as a date.When I do "Preview Query" as an object, I get the correct results, but bad results as a Date. I would just leave them as objects, but it errors out when I try to pass a date in.Here's the part of my query that I'm having trouble with:

(Tickets.Resolved >= str_to_date(@startDate, '%m/%d/%Y')) AND (Tickets.Resolved <= str_to_date(@endDate, '%m/%d/%Y')) AND
(Tickets.Status = 'resolved' OR
Tickets.Status = 'rejected')

View 2 Replies

Adding And Passing Value Between Forms

Apr 10, 2009

I am trying to do a really simple function (atleast it was simple in 6.0)... what I want to do is have two forms. One with a textbox, and one with a button and a textbox (we'll call this one form2). When I add a value to form2 and click the button I want the text to appear in form1's textbox.

My code in form2 is...
' on event button1_click...
form1.textbox1.text = me.textbox1.text
("me" being form2)
Anyways, how to pass a value from one form to another.

View 3 Replies







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