In C# I would like to take TWO different projects of windows form application and inserting record in one exe i.e one form and automatic shows the inserted data into another form just like refresh, but I will not using any control like Button Refresh, update.
You have many options to solve your problem.
1) Either use a database, when the 1st app inserts into it, the 2nd app periodically looks for new records in the database, and displays them.
2) Or use a file, in the same way. The first app writes into it, and the second app reads the file periodically and display the rows.
You may need to use a Timer for this purpose.
Related
I am creating a application using Composite UI Application Block(CAB).I have taken a TabWorkspace.
My problem is that I am taking a handle of a cam device in one tab and want to pass the handle in other tab.
Any one can suggest how to pass the value in one tab to other.
Make a common.cs file. you have to assign first in an bvariable in cs file and get it
I currently have two forms. The first form has a dataGridView on it, the second form has six text boxes and a button. On the button click the information is taken from the text boxes and put into the dataGridView. The problem I am having is that when I exit the application and run the application again there is no data shown in the dataGridView. How can I resolve this?
Is there a way to save the information inputted into the dataGridView or would I have to make a data table and store the information from the text boxes in there and then use that as a data source for the dataGridView?
As you said you could use a datatable to store the info of the textbox but when you will close the application you will still lose the info.
if you want to keep information from each time you ran you application you will need to save the info in a file or in a database
Yo have to use a database for saving data,or you can save your data in a TXT file and save them in file.
Add a local DB to your project and bind the dataGridView to it.
I am building a Winform based C# desktop application. I have a number of Combox control which the user can select the input from the drop down list or manually enter an input. The Combox Items itself is populated from a static list.
Whenever the user enters a new input which is not present the list, I add to this static list.
Here is the small code snippet which does that :
if (!this.client_type.Items.Contains(items.ClientType))
{
ComboItems.ClientList.Add(temp.CourtName);
}
So far, this approach works as long as the application does not close or exit. When the application restarts, the list does not have the manually entered items.
I am considering saving the list in a configuration file. Is there any other approach apart from using a configuration file ?
Thanks
Any type of serialization should work. A couple of popular ideas:
Database: If you are already saving data to a database or if you want that same customized list to be available to all users regardless of if they are on the same machine then that may make the most sense.
XML: If the changes should be per box that it runs on then you would want to store it locally. XML is popular and there are libraries available in the framework to work with XML files.
Here is a link to look into other options.
Is there any other approach apart from using a configuration file?
Yes. (For example, a database.)
You might also take into consideration writing and loading the items list into the registry. Here is a link containing a nice tutorial on it's manipulation: http://www.codeproject.com/Articles/3389/Read-write-and-delete-from-registry-with-C
I have an ASP.net (C#) application that I am working on. In the application are multiple pages of form fields to be filled out and submitted. At the bottom of the last page is a submit button which writes everything to the databse. The code for writing these fields from form to DB is very complex as there are about 30 different stored procedures being called. I am trying to create a duplicate when a user clicks on a new button called "replicate", which SHOULD store a duplicate copy in the DB. I try to copy paste the code for write to DB from the "submit" button but I get a bunch of problems. I have tried a lot of different approaches such as pasting the submit button's code in a new method and from the "replicate" button call that method but this approach doesn't work. So, I am confused as to whether there is an easier way to duplicate the submitted copy that is being stored in the DB. Normally a couple SQL statements would work but in this case there are about 35 stored procedures, 70 SQL tables, and 425 columns, which is a problem.
So basically a summary of the problem is:
I have a form that on submit, writes the filled fields into various locations in the DB, depending on what the field is.
I would like to create a "replicate" button that duplicates the DB stored fields of the form creating a duplicate copy.
Issue: As I stated there are about 215 form fields and 70 SQL tables, each form field going into a certain column in the table.
I would go about this by creating one more stored procedure which does the copying directly in the database. Then you could have your "Replicate" button call the new stored procedure which creates the copy and returns some handle (some base id value created for the copy) and use the handle to load the copied version into the application. Make sure to run the copying inside a transaction so you either get a complete copy to commit or can rollback if some error occurred.
I have an app written in c#.
Records from the DB are shown through the auto-generated visual studio code (DataTableAdapter).
this._______tTableAdapter.Fill(this._______SQLDataSet._______);
Now, when I make changes to the DB, not through the DataTableAdaper - but through code on another winform, close it and open another where I have my DataTable filled with adapter, the changes are not shown until I restart my app.
I don't get it, I tryed closing the window using this.Close() and this.Dispose() to release all the resources, so the next time I open it, the code should rebind the new data from the database, but that's not the case...
What am I doing wrong?
Thanks very much for any anwser...
Have you tried explicitly calling DataGridView.Rows.Clear() when you are loading the form?
If that doesn't work, load the form in debug mode, and look at the status of the data every step of the way.
My suggestion/comment may not meet your conditions, but referring to this problem, notice, that you can also modify data in DataSet (not passing the calculations on the server witch every change). If all changes are made - you can call Update method on data adapter which provide data updates for all changed rows.
Anyway - if you want only refresh changes made in other instance - just refrech DataGridView or set DataSource again.