DB/Reporting :: Forms Sharing 1 Dataset?
Sep 21, 2008What 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 RepliesWhat 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 RepliesAm 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
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 RepliesI 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]...
I want to do something like this:
Code:
'create a dataset and a table
Dim ds As New DataSet
[code].....
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.
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 RepliesHow 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...
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].....
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] .....
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 RepliesI 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.
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]....
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 RepliesI 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).
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 RepliesI 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].....
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).
I am trying to develop a report that displays the result of a query that returns two tables. The first table is always a single row of values, the second should be a grid. I can get a report to display either independently, however it will not allow me put them both on the same report.
View 1 RepliesI have a dataset that I'm trying to loop through to be able to save any changes made to that dataset and update my database doing so. Is that possible? I've seen that it's possible to do it with datatables but not datasets. If so, can someone offer a starting point for me to learn with?
View 1 RepliesWhat is the best place (event/procedure) to use the newest record when navigating from record to record on a form.
For example, I want to do a calculation on 2 text boxes that are bound to a dataset. This calculation will be done each time a new record is navigated to.
Today i have been checking out the concept of datasets and i like the way they work except for a minor issue i have with it.The following code should get a databasetable and put it in a dataset and return that set to the user.[code]I submit the table name and it will select it, read it and fill the dataset with it, then return it. And it does exactly that once.If i try to re-read the same datatable it just returns the exact same dataset as the first time yet i am 100000% sure that i changed it .
View 1 Repliesi'm using vb 2008 express editor, and 3.5 compact sql, through my program, i make changes, like altering rows, deleting or adding new rows, to a dataset. i want, that when button 1 is pressed, all changes made to that dataset, are updated to my database. what is the line of code that does this? [Code]
View 1 RepliesI am using VS 2008, VB.NET and Windows XP r3.I am trying to use LINQ to DataSet in my app. In my test app, I can get it to work find. My test form has an OleDbDataAdapter, an OleDbConnection and a DataSet. It also has a DataGridView bound to the one table in the DataSet, a BindingSource and a Button.[code]
View 7 RepliesI'm having a problem with a database. I"m using these two functions to add and remove folders to the database:
Code:
Private Sub AddToFoldersTable(ByVal AddFolder As String)
If FoldersBindingSource.Find("Folderpath", AddFolder) = -1 Then
[code]......
Here is my code that parses an XML string to a datagridview:
Dim DS As New DataSet
DS.ReadXml(New StringReader(StringHTML))
DataGridView.DataSource = DS
[code]....
Child list for field Produits cannot be created.I'm sure it's something so simple you guys are chuckling...Can't wait to see what's the problem
We are updating our SQL SERVER 2005 database to reflect the name of our new corporate masters and we need to change the values of the fields.
Once we do so, we will hit those fields with update queries, but right now, my group just needs a listing of the affected tables There are over 250 tables to search, is there a way to iterate through the tables?
I imagine I could search the datatables once I get them, so that part isn't a problem. I just need to know how to set up some code to peek in, record what needs to be changed, close it and move on to the next table.
I've done as much for a single table, but never a load like this.
I have an untyped DataSet: "ResultsData",which contains several tables: eg "EntryList_table".The Parent Form reads lines from a text file, parses the line, and distributes the necessary data to the corresponding data table.I then have several child forms which contain DataGridViews, each displaying the data in a unique format. All of these tables are Read only, and the DataGrid views only need to display the data attached. However, when I open the child forms, the data does not seem to update with each line read from the text file? As they are bound to the DataTables in 'ResultsData', the column headings appear correct, but will not populate the new data.I would like to have a 'Shared' DataSet that can be accessed by each child form (when activated), and will allow continuous modifications as the input lines are read.
View 6 Repliesputting images in a dataset. I'm developing a windows application that accesses an sql server database in another server, an sql server 2000 database. A table, tblProducts, contains a field called ProdImage with type VarChar. ProdImage contains the path of the image which is stored in the server's file system.
[Code]...
I have a program that I designed that scans my music folder, gets the id3 information, and then in turn inserts the results into a dataset
Here is what I have:
MusicLibrary.sdf with a table called MusicLib
MusicLibraryDataSet
MusicLibBindingSource
MusicLibTableAdapter
DataGridView
So far here is where I am, if I open the database through the visual studio ide, I manually put in a few songs just for testing purposes. When I run the program the DataGridView displays the data I entered. However I can't seem to figure out how to actually programatically add songs to the database. This is what i did so far:
I execute this command for each song scanned:MusicLibraryDataSet.MusicLib.AddMusicLibRow("FileName", "Artist", "Album", "Title", "Track") Then when done execute this command:MusicLibraryDataSet.MusicLib.AcceptChanges()
After I do that how do I then insert these items into the sql database itself so that the next time I load up my program the info is there. I have plenty of sql experience, but am used to doing all this in asp.net, i've never quite gotten all the table adapters and stuff.