Sharing UI Validation Between Forms?

Jan 25, 2012

I am trying to figure out how to seperate my business logic from my forms. This is my first attempt at doing this, but I would like to figure out how to handle events from multiple forms within a class. I have found myself routinely writing the same logic over and over in each form class and its time I figure out how to completly seperate out that logic in winforms so I can reuse the methods across all of my forms.

So basically I have this click event in form1:
Private Sub btnSubmit_Click(sender As System.Object, e As System.EventArgs) Handles btnSubmit.Click

[code].....

View 1 Replies


ADVERTISEMENT

Sharing Business Logic Between Windows Forms And Web Forms?

Feb 4, 2010

My question is, am I able to share a business logic layer seemlessly between the two presentation layers or is there anything I need to watch out for. I'd really like to not have any duplication of business logic, so any advice would be more than welcome.

View 3 Replies

Forms :: Sharing Settings XML Document Between Forms?

Dec 26, 2009

I have an application built that has several forms. I use an XML file to store settings data (mainly folder names for data output) and I need each form to be able to access and modify the data. I'd also like each form to access functions from a main form (such as file parsing functions). I have read articles about properties and inheritance but I need some guidance as this topic is pretty confusing.

[Code]...

View 10 Replies

Sharing Data Between Forms?

Nov 17, 2009

I am working with several RFID readers that perform different function in my vb.net program. Currently each reader port number is hard coded into the respective form. For example, reader 3 operates on COM1. However, this will be problematic when installing on different machines.

What I would like to do is have a "configuration" form where the user can select each reader and then select the COM port. Then all other code references these settings. What would be the best approach for this.

The only way I know to do it currently is to place this information in a small database and then have the forms reference that database, but it is a lot to do for such a seemingly trivial task.

View 3 Replies

Sharing Resources Between Forms?

Apr 12, 2010

I have some icons and images that are stored as embedded resources in my form1.resx file. Is there any way I can access these resources from my Form2 without adding the icons as project resources?

View 5 Replies

Sharing Text Between Forms?

Sep 9, 2008

How do I share text between forms?I want a box to popup exactly like a input box, but needs to be multiline, Is there any east way to do this or will I have to create a second form?If so, how do I share the string between forms to then output in a textbox on 1st form?

Also, I have VB 2008 Standard, and I want to build an application for a handheld, Is it possible to build an application and then pass it over to someone who has the professional version to make it work on pocket pc? Or does the entire build have to be on pro already?It's a very simple program...

View 4 Replies

Sharing Variable Value Between Forms

Jul 31, 2009

When I declare a variable as public, shouldn't it be available in another form? I am trying to write a windows mobile prg with 12 static mileage points, form1 has the 12 buttons for start point, but when I call form2 with the destination points, my start variable value is not carried over. I intend to then assign a mileage based on the two points and write to file on mobile device. We support 12 schools, and I want my employees to track mileage easily.

Public Class main
Public start As String = "start"
Public dest As String = "dest"
Public miles As Decimal = 0
[Code] .....

View 4 Replies

Sharing Variables Between Forms?

Jun 16, 2010

i've almost completed my Yahtzee game except for the high scores function. I've got everything worked out except how to take the highscore variable from Form1, and share the data with Form 2

View 12 Replies

Best Practice For Sharing Variables Across Forms?

Mar 27, 2011

I need to share variables across two forms in vb.net. One of them is the main form and the other is a child form.

Create a static/shared variable in one of the forms and access it in the other forms via:
Form1 frm = new Form1(); //creating object of parent to access shared variable
frm.a = "abc"; // passing value

Send an instance of the main form to the child form when creating the child form. The variables can then be accessed via a property function. Create global variables in a module. This seems like the easiest option, but I doubt it is the best option.I also read something about delegates and events, but I don't know how to implement this.

View 4 Replies

DB/Reporting :: Forms Sharing 1 Dataset?

Sep 21, 2008

What I mean is that when I make queries on a Parent Form. Child forms can also retrieves the datatable /datarows from its parent form.

View 3 Replies

.net - Sharing Mdb Access Connection Among Multiple Forms?

Sep 7, 2010

I'm starting to put in a database into my application, however I'm drawing a blank on how to share a database connection among the dozen or so different forms in my MDI application. I'm assuming this has to do with interfaces or something but I can't find any relevant examples anywhere. Can someone help me out? Ideally what I'd like is when the app is loaded up there is a call to a function in the forms loading area which establishes a single connection to the mdb, that I can then call via any form so I don't always have to open/close connections everytime I need to update the db?

Here's a basic example of the mdb database access code I've got working:

Dim dt As DataTable = New DataTable()
Dim OleDbTran As OleDbTransaction = Nothing
Using connJET As OleDbConnection = New OleDbConnection("connection string here...")

[code]....

View 1 Replies

Child Forms Are Sharing Controls And Conflicting

Feb 7, 2012

I have a form that can spawn a child form, something like:[code]I want to be able to launch multiple children. Unfortunately, I seem to be getting conflicts within the controls of the children. One button will run the other child's control, etc. They also seem to think that their class-level variables are accessible to each other. Private Shared variables like the following are conflicting (one form thinks it's seeing the other form's "mp3file" variable as their own):[code]How do I spawn children forms that keep their controls and data separate?

View 1 Replies

Forms :: Sharing Data By Declaring Object

Mar 31, 2010

I have two forms A and B. B is a child of A - i.e. I have a button on A that pops up form B. I want B to be able to access and change data (e.g. an instance of an object etc.) in A and also to call some function in A. At the same time I'd like to preserve the right to alter the data in A without opening B. I've achieved this using the following (i.e. by declaring the object and method as Friend):

Public Class frmA
Friend _data as Hashtable
Friend Sub GetData()
If _data IsNot Nothing Then
_data As New Hashtable

Is there anything inherently wrong with the what I've done and if so how can I achieve a similar result? (It seems to work - I can read, add to and change the values in the _data Hashtable from within form B and when B is closed the values persist i.e. I can access the changed values from within form A. I just dont know if its a horrible fudge).

View 2 Replies

Save Data When Sharing Databindings Across Forms?

Sep 24, 2010

I am sharing databinding when opening a detail form a summary form. The data is shared fine. What I don't know is how to save any data that may have changed, or to create a new record.[code]...

View 2 Replies

Sharing Multi-dimensional Arrays Across Different Forms In VB?

Jul 9, 2011

I have a very simple 2D array, it holds a list of song titles, their genre, and their runtime. frmMain loads the array from a text file and allows me to manipulate it and boil it down to a desired (implicitly sized) playlist. i want to THEN pass that playlist array to a second form, frmPlaylist The problem i'm running into....When frmPLaylist calls the Property from frmMain I receive an error that VB cannot convert the string value to a two dimensional array. Simplified...frmPlaylist is all locked and ready to receive a 2D array, but frmMain seems to only be sending a single string variable. on frmMain

Public ReadOnly Property PlaylistOut() As String
Get
Return mstrTimedPlaylist(,)

[code].....

View 1 Replies

Multiple Full-Screen Forms Sharing Data?

Sep 13, 2011

My question is in two parts:

1) I am writing an application for a touchscreen which will have several different Forms - each of which will be full-screen. What is the best way to achieve this? Hide/show each Form as the user navigates between screens? MDI Parent with multiple Child Forms becoming visible 'on top'? Or is there a more elegant solution?

2) I would also like a 'banner' on the top of each Form (or always visible on the top of the MDI Parent, etc) similar to a 'navigation frame' on a website. This banner will display a clock with the current time, and the current GPS location (meaning that a Timer will be used to get/set these values every 1000 milliseconds). I thought of using a UserControl for the banner - but if this is used on multiple Forms then I will end-up with multiple Timers all waiting 1000 milliseconds to update essentially the same information.

Is there a best practice for this type of scenario? - my thoughts so far are using the "Main" Form for Global Timers, etc - but then how do I update all Form clocks each second? (without iterating through all visible Forms... which seems messy).

View 5 Replies

Master Detail Form+bindingsource Sharing The Same Dataset On 2 Different Forms 1 With Grid Other With Editing

Dec 9, 2009

Am new to VB, can anyone tell me very simple how to share the MAIN Bindingsource with an detail form where i want to edit 1 record from the main datasource?
andreg

View 3 Replies

Forms :: TextBox Validation?

Mar 16, 2010

My question is the last code tag section above where the parameters are set for the input.If on the form there is a textbox that is required (on the db side to not allow nulls) how would you perform the validation before you tried to execute the update sql?Ex: say 'SerialNumberTextbox.Text' was empty or if you needed to have character constraints on what was typed like varchar(15) and they have 16 or more characters

View 7 Replies

Forms :: Data Validation In Textboxes?

Dec 7, 2009

I Have four textboxes, I want textbox1 to accept only char data.I want textbox2 to accept only numeric data.I want textbox3 to accept

View 1 Replies

Forms :: Validation Improvments(for Textbox)?

Mar 20, 2009

on my form i have 2 text boxes. One email the other password. Her eis my code

Private Sub btnLog_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLog.Click
If String.IsNullOrEmpty(txtMail.Text) Then
'txtMail is empty
MessageBox.Show("Email is empty", "Error", MessageBoxButtons.OK, _
MessageBoxIcon.Error, MessageBoxDefaultButton.Button1)

[Code]...

How can i make this more efficient. So that txtMail checks for text first then @ then more text then .com or something? i,m sure you know what i mean.and textpassword is more then 2 or three chars?

View 1 Replies

Forms :: Textbox Validation - Input Number Between 1 To 12

Mar 9, 2009

I am new to visual basic. Below is my
Private Sub todayMonth_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles todayMonth.Validating
Dim tb As TextBox = DirectCast(sender, TextBox)
If Convert.ToInt32(tb.Text) >= 1 And Convert.ToInt32(tb.Text) <= 12 Then
tb.Tag = True
[Code] .....

Actually, I wanted to validate the todayMonth textbox just to input number between 1 to 12. The problem comes out when I do this procedure : Lets say I input an interger 11 and it passes the validation and proceed to another textbox. Then I click back to the todayMonth textbox, it shows this error :
"Conversion from string "" to type 'Integer' is not valid."
I don't know why my value in the textbox is "null" or empty . I still saw the value 11 on the textbox.

View 3 Replies

Winforms - TextBox Validation In .NET And Windows Forms?

Mar 5, 2009

I'm using the following code to validate the text entered by user. It works perfectly fine. But I want to add the backspace feature so as to allow the user to delete the wrongly entered number.I have tried a couple of things and they worked but before last digit (after the decimal point) i.e. it does not allows to delete after the number has been completely entered.number is being entered in the format: 12313213.45

What shall I do?Private Sub TextBox5_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox5.KeyPress

[Code]...

View 7 Replies

Adding A Close Button To BindingNavigator And "sharing" It With Other Forms

Nov 19, 2007

I want to add a close button to a custom navigator. That's fine.

Now what if I want to use it on every form that I would create ? What is the best way (Is subclassing possible for this control in that case, ...) ? Any inspiring code somewhere even for another type of control ?

View 9 Replies

Create FK To Model, From Aspnet Forms Validation Tables

Jan 17, 2012

I've recently created a MVC 3 ASP.net application (using VB). I have also created forms validation by running aspnet_regsql. I used this to create the table in the same database as my application uses. I am trying to work out how to create a new model, with a FK from the Users table. Do I have to reverse engineer the validation tables to create models in my application? right now, the tables only exist on the SQL 2008 database, as they were created by running the aspnet_regsql command, and do not exists as models in my ASP.net solution. Here is the code I have now, for a model I would like to add a FK to (as a one-to-many relationship):

Imports System.Data.Entity
Imports System.ComponentModel
Imports System.ComponentModel.DataAnnotations

[Code]....

View 1 Replies

Disable Validation On All Forms When User Closes Application?

Feb 26, 2012

Is there an easy way to disable all form validation when the user clicks on the "X" icon to close an application or when the user clicks on a button in the application that closes the application?[url]...

View 1 Replies

2 Forms Sharing The Same Value (Dim Name As String="App1")

Sep 11, 2009

I want 2 forms the main form which is form1.vb and the second form which is form2.vb to share the same value:

Dim Name As String="App1" so i can use it by simple doing that:
[Form1.vb]
Public Class Form1

[Code].....

Or it could be better if i didnt have to add a reference to the main form the string Name should be already declared in the second form so i could use just:

Textbox1.Text = Name

View 6 Replies

Forms :: Skip Validation Of Active Control When Form's Close Button Is Clicked

Aug 12, 2009

Is there any way to skip a the validating event of the active control when the close button of the form is clicked. It is very annoying when user wants to close the form, but due to the validate event of the active control, it asks for the valid input. The user is forced to give valid input to close the form. I have searched a lot for this on net but no any proper solution could be found.

View 5 Replies

File Sharing Without Using LAN

Jun 6, 2011

We are given a task to create a software that can share files between two computers without using lan (internet connection) but the presence of hardware devices can be used like cable, rs232, usb to usb or can be bluetooth to bluetooth file sharing. We searched about file sharing without using lan. The result was "socket programming". Is socket programming is applicable for vb.net? If yes, how is it program?

View 1 Replies

Sharing A Private Sub?

Jul 10, 2011

how to make projects which span multiple files and classes just fine. I've had big multi-file things working.I've been told explicity that my classes have to be private...yet at the same time I'm supposed to have a main method elsewhere and somehow call a menu in my main working file.I can get the program working perfectly when I do it in a logical manner but I just can't figure out how to call a private sub. I keep getting the error reference to a non-shared member requires an object reference.I've tried breaking the rules a bit and making one initial sub which is public, shared, etc... but all this does is delays the error until it tries to call its first private sub.

View 3 Replies

C# - Sharing Code Between 2 Projects Without A Dll

Dec 2, 2010

How can I have code-sharing between two projects without making a dll?

The issue is: I have a tool that syncs users & groups from LDAP to a database.

Now the tool is a windows service, but testing it as such is very difficult and time consuming.

Which is why I made a console application where I can test the LDAP syncing, and then just copy the respective sourcecode-files over to the service project.

But... keeping the common files in sync is a bit of a problem. I don't want to make a dll, because this probably creates me a problem with the 3rd project, a windows installer (for the service) where I have to use ExecutingAssembly path...

Is there a way to share the code without making a separate dll? Automagic statical linking, so to say ?

View 6 Replies







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