How To Share DataSet Among Two Forms

Jan 13, 2009

I'm new to VB2008 and SQL Server. I have two forms (frmCustomer and frmDetail). The frmCustomer has a datagridview containing general data of customers, and a button to open frmDetail, which contains each customers detail information. All data modification is done on frmDetail (add, delete, and edit). Currently, both forms are binded to the dataset (same table). When the two forms are loaded, each form performs a FILL function that retrieves the data from SQL Server. In addition, all modifications done on frmDetail does not show up on frmCustomer until I perform the FILL function again on both forms. Seems like I'm maintaining 2 sets of data from the same table, and I think I'm doing more work than I have to. I'm sure there are ways to make this easier, such as bind both forms to a single dataset, so I don't have to do everything twice.

View 1 Replies


ADVERTISEMENT

Share Dataset Between Classes In A Windows Service

Apr 20, 2012

In all the Windows Forms Projects I've been able to share a dataset between the forms without a problem, so I assumed that it would be the same in a Windows Service. The issue I'm having is getting Class B to reference an existing dataset in Class that contains data. "Serv" is the class containing the dataset. When I say "Dim Serv1 as New Serv" and then declare my dataset/datatable references, the debug is showing that the dataset is empty, but I know the dataset contains data because I filled it in another sub procedure and checked that it contains data. How do I share a dataset between classes in a Windows Service?

View 2 Replies

How To Share Variables Between Forms

Feb 17, 2012

Is it possible to share subscripted variables and their data between forms? So far I can't see the variables I made public in one form, in a second form.

View 5 Replies

Share Forms Between Projects?

Dec 19, 2009

I've recently noticed that a solution can contain multiple projects. I'd like to know if I can create a form that exists in multiple projects, so i can edit one form (or class) instead of six, and have it published in each one of them separately? I hope that makes sense....I seek not answers, but understanding, that I may not solve, but learn.
What good is a fish without the skill to catch it?

View 4 Replies

Share Variables With Other Forms?

Mar 6, 2010

Say I have public string variable called "_Test" on Form1, how can I allow Form2 to edit/read the variable from that form? I tried putting this on Form2:

Public _Test as String = Form1._Test

But if I start Form2 without Form1 being open, it gives me an exception.

View 4 Replies

Share A String With Multiple Forms?

Apr 13, 2009

I need to share strings (array) with more then one form.

View 3 Replies

VS 2010 Share A Menu Bar Between Two Forms?

Jun 17, 2010

I'm writing a small software similar to the calculator in Windows, the calculator in Windows has a menu bar; in the menu bar, you can find "scientific" and "standard" mode; once you select different mode, your form will be changed, but the two forms still share the same menu bar.

I want to create the same effect of this:

1. Two forms, only one is visible at any time

2. The menu bar on the top of the two forms should be shared between these forms

I just started learning VB for 2 weeks, I'm not sure my thinking can be achieved by VB, if not

View 4 Replies

VS 2005 Where To Declare A Class To Share Between Two Forms?

Aug 24, 2011

There are two forms, first form list's the employees and the second form is used to add,edit the employee record. So to pass the information between the two forms i want to use the Employee Objects.To do so, where should i declare the Employee Class?

View 6 Replies

VS 2010 : Share And Edit Variables Between Forms?

Jul 7, 2011

how to share and edit variables between forms? I want the user to be able to enter a value into a textbox and the program store it and then load another form and do calculations and display answers but I can't get it to work.

View 2 Replies

Forms :: Share Data Between Forms (as Opposed To Passing Data)

Nov 26, 2011

Quite a few threads on passing data from one form to another, but I'm struggling to work out how to share data between the two - back and forth.

For example:

Class1 is a class with 10 string properties

Form1 has 10 labels ("Label1", "Label2" etc) and a [Configure] button.
Form2 has 10 textboxes and a [Apply] button.

I want to load with Form1, and create an instance of Class1. Click the Configure button and load Form2, passing Class1. On Form2 I want to manually fill in the 10 textboxes and hit Apply. The Apply should update the Class1 instance and close the form.

Form1's Label controls should then be updated with the data from the Class1 instance.

I'm fine creating the forms and classes, as well as passing the class into Form2 with a custom Sub New(EmptyClass as Class1) constructor. This gets the empty class into Form2, but how can I get the populated class back to Form1?

As Form1 already exists I don't want to create a new instance with another custom Sub New(PopulatedClass as Class1)

It's also key to be able to use the Form2 multiple times, basically ending up with a Data class being displayed as part of Form1 but updated using Form2? (For example if the Class has already been created and populated with data when it's passed back to Form2 for the second time I would pre-load the Textboxes with the values already in the class).

View 3 Replies

Use One Dataset With Many Different Forms?

Jan 3, 2011

In my application, I have created a dataset which is used as a lookup data and I have a couple of forms that use this dataset.

Generally, VS will generate a line of code that fills data into dataset using tableadapter when the form is loaded.

I have parent and child forms. In the parent form I've already filled the dataset and I don't want to fill the same dataset again and again every time I load a new child forms that use the same dataset. Are there any ways to do that? Or is it ok to fill the dataset for every form?

Can it cause any performance to my application?

View 6 Replies

.net - Dataset Parameter In Forms App?

Jun 24, 2011

I'm having a hard time to find out how to pass at run time a parameter which I defined in an adapter in a dataset. When I preview the data I can insert the value manually, but I was not able to find any code around how to pass it in the visual basic code.

View 2 Replies

One Dataset For Several Forms - Databinding

Oct 9, 2009

My project currently holds one dataset and several forms. In each form I have dropped an instance of that dataset and certain editors are bound to tables of that dataset instance. Now this means that when each form is loaded I also have to load the relevant data into the dataset instance of that form (basically i am loading the same data more than once).

[Code]...

View 8 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

Forms :: Dataset Query Not Acting Right?

Nov 29, 2011

I have an application that uses bound controls on the form. I have a dataset associated with my form and have a custom query written for one of my tables that is supposed to get two fields in the database and order them by their ID in descending order. However, when I run the program, the bound controls do not contain the last record, but the first.

View 8 Replies

Forms :: How To Create DataSet And Tables From XML

Aug 4, 2011

I have an XML file that has a basic hierarchical structure about horse racing. It has a summary of the tracks, some data about each track, then a list of all the races at each track racing that day. So lets say there are 10 tracks, and for each track there are 8 races. This is a snapshot of the data....

HTML
-<Meetings xmlns="" Jurisdiction="VIC">
-<Summary MID="MR_20110801">
<VenueName>ECHUCA (VIC)</VenueName>
<Type>R</Type>
<Events>10</Events>
<Track>DEAD </Track>
[Code] ......

I have written the code to pull down the data into a data store, but I dont know the BEST way to put the data into a set of tables. My first thought was to traverse the nodes and add rows into tables but I figure there must be a native VB process that reads the xml and puts it into the the appropriate table. How to code up the process for getting the data into a set of tables that match the xml. So lets say I have a Summary table, I would like all the data about each track to go into that table. Then I would have a Races table and have the data for each race go into that. What I have done already is import the xml into Access to create the tables (which was a breeze!) and then link that data source to my project. So I have the tables already built.

View 5 Replies

Forms :: Making A Dataset Editable

Sep 8, 2010

I have a form that when a user clicks on a button that it opens a new window with a dataset. Is it possible to be able to edit that dataset and have messagebox.shows along with that for approval?

View 2 Replies

Forms :: Multiline Textbox With XML And Dataset?

Apr 20, 2009

Ok, as in my other post i asked this!!

If TextBox7.Text.Contains(ComboBox1.Text) Then
If ComboBox1.Text = "" Then
Else

[code].....

View 4 Replies

Forms :: Progress Bar And Load Dataset?

Dec 17, 2009

so what I want to do should be pretty simple. I've been following the examples found here Using the BackgroundWorker Component - VBForums . I've been successful, but I'm not smart enough to put it in my project.

What I'd like to happen is this

1. I hit a button to load data from a dataset....

2. have a progress bar show until this action is complete.

The main problem is that I can't figure out how to tie the "progress bar" to the action of "pulling the dataset"

I'm sure this is a crazy question for you all, but hey...

Would I put all of the coding in the button_Click sub?

View 9 Replies

Updating Dataset On Bound Forms?

Apr 11, 2011

I have added a SQL Server datasource through the wizard. I created my forms which were bound to the dataset. Is it possible to change the datasource and dataset names while updating the dataset the binding controls of the form?

For instance, Server 1 has DB1 and Server 2 has DB2 (DB1 & DB2 store the same information/tables). Is it possible to keep the forms and only update the binding information if I want the forms to use DB2?

View 3 Replies

Forms :: Count Rows On Dataset With WHERE Condition

Jan 7, 2010

I have a dataset that I search using the

dataset.tables("table").Select("WHERE clause")

method to query. I then use a datarepeater to display the results. Is there a way to programatically tell if no results are returned? I'm aware of the Dataset.tables.Rows.count, but can this be done after the select method?

[Code]...

View 2 Replies

Forms :: Login Form With Added Dataset?

Mar 7, 2010

My background is mostly Access VBA and I am having to learn VB.NET. I am trying to recreate an Access 2007 application I wrote into VB.Net. We are looking at using a hosted SQL Server so we do not have to worry about remote offices or replication. I am using VS 2008 and SS2008.My issue is that I need to create a login form in VB that with look at SQL Server DB and return a dataset record matching the username and password. There are many tutorials on here but do not match what I am looking for.I have a stored procedure with 2 parameters (@prmUser and @prmPassword) named spLogin.I need to call the sp and pass the parameters to SQL Server DB and return the complete row of data that is matched from the button_click event on my form.

In Access, I would have a form that would have the returned data and I would reference that information throughout the application by using the 'forms!frmName!txtValue' to populate forms, reports, and fields that would capture the user that created the record. What is the best practice for this?Next when the login credentials are correct then I need another form to open, which is my MDI form, if not correct then msgbox to try again.

View 16 Replies

Forms :: Binding A Dataset (computer Column) To A Datagridview?

Aug 17, 2011

[URL] some properties aren't showing in my vb just like the one needed in the video..my computed column is made only by

-project
-add new item
-dataset

then i just changed the expression property

View 5 Replies

Forms :: Generate A DataSet And Bind It To A Datarepeater Object?

Aug 30, 2011

This is my first post here so forgive me if I am not following any correct protocols. I am attempting to generate a DataSet and bind it to a datarepeater object. I had been doing this at Design Time and was getting an error message when filling the dataset when the form loaded. So I am basically createing the dataset in my code now when the form loads and binding it to the datarepeater. However, when I attempt to bind the dataset I get a NullReferenceException - even through I know that there are 60 rows of data in the dataset table.

[Code]...

As you can see i have several debug messages in there. I get the error on the last line when setting the datarepeater data source. I try and get data for a specified lot - if it doesn't return any values I create some values in the datatable and add them to the DB. On first load when there is no data this works perfectly. If I then close the form and reload it, it will display fine. However, if I change any of the data (database is updated) and then go back in again, I get the error above.

View 1 Replies

Forms :: Choose Item From ComboBox And Save Selected Value To DataSet

Dec 23, 2009

I have a problem with a combobox. I have a form (with information about clients) with textboxes binded to a dataview. One of the columns in the dataview contains a number that tells me what kind of client it is. I don't my users want that my users have to fill in a number in a textbox, but I want them to choose a item from a combobox. De selected value should be the value that is actually saved in the database.

This is my
Dim cmd As New SqlCommand
Dim dr As SqlDataReader
VerbindingMaken()
cmd.Connection = cnnVraagbaak
cmd.CommandType = CommandType.StoredProcedure
[Code] .....

De Datasource is the information in my combobox. With Databindings I'm trying to bind it to my dataset (or view, that doesn't work either) with clients. Every time I get a NullReferenceExeption. The moment I remove the line cbo.DataSource = dsRelatie.Tables("Relatiesoort"), I don't get an error, but it doesn't work either.

That dataset is filled (I've checked) and also the derived view. The column Relatiesoort exists. What do I have to do to make it possible for my users to choose an item from a combobox and save the selected value to the underlying dataset?

View 1 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 :: Internal Dataset Or Internal XML File?

May 3, 2009

Is it possible to have an internal XML dataset within a VB 08 program I ask because we at present have the program load an external XML on startup, but i would prefer this to be internal withing the program to stop other editing the XML file.

View 6 Replies

DataSet Editor - Allows The User To Edit A DataTable In A Strongly-typed DataSet

Mar 15, 2010

When the user clicks an "Edit" button on my form, I want a box to come up which allows the user to edit a DataTable in a strongly-typed DataSet. What's the best way to do this?

View 2 Replies

IDE :: Dataset Code Behind Datatable.ColumnChanging Event Firing / But Dataset.HasChanges Property Not True

Jan 28, 2010

I have code running in the Datatable.ColumnChanging event in my dataset. This dataset underlies a form and conventional drag/drop controls are in place for data entry.when the event triggers and runs, I am running code in the form that checks the dataset.HasChanges property. It is showing False. But this is immediately after the ColumnChanging event has been triggered.Okay, I see by others posts and MSDN that .HasChanges will only be true after moving off the row with the changed column. I have also noted lots of discussion about the advanced binding property of DataSourceUpdate Mode, but that does not address this issue.I guess I can do this by checking the state of the row for the binding source. Just seems odd that the event behind the dataset can be triggered and that does not change the dataset.HasChanges property.

View 3 Replies

System.Data.Common.DbDataAdapter.Fill(DataSet DataSet)

May 14, 2012

I have tried everything I can to get beyond this error which shows below as <<<<< error here. It is trying to fill a dataset from a data adapter. If I change the SELECT statement to just SELECT * FROM xTable I get the correct number of records in each table. But anytime I try with a more complex statement I get the error message shown below which indicates System.Data.Common.DbDataAdapter.Fill(DataSet dataSet. I've completely erased all data and entered a new set of test data so I know there is no problem with relationships. Each table has primary key which is foreign key in other table. IS there something wrong with the Imports section: Imports System

[Code]...

View 2 Replies







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