work with data grid view in C# windows forms - c#

Dear sir,
I m developing one application on c# windows forms by using OLEDB connection.On that one form i placed one datagridview and bind to one table.That table contains some fields....., here my problem is i want to edit table on runtime.On that table i need two links as edit,unmask.In runtime data in datagridview is seems to plain text on paper.if we click edit that row changed to text boxes and combo boxes.Sometext boxes contain passwords also.those are in ** formate.while picking unmask button those passwords are changed to actual text.while picking edit button that exploted to update, cancel.Then we change the data and pick update then data stored to database table.(i need datagridview as gridview in ASP.Net).Is there any properties for datagridview as gridview(ASP).Could you please suggest me how to resolve my prob.
Thanks in advance.

Can you, at the time of the hang, hit pause in Visual Studio to see where your code hangs?

Related

how to clone a datagridview in c#?

i use visual studio 2012 c#. I tried to do something but unfortunately it's not working.
My problem:
I have a form with two datagridviews: one should be master and the other details(clone).
1-) such that When a row is selected in the master datagridview, the detail or clone datagridview is populated with data pertaining to the selected row.
2-) Secondly, What I am want to do is print (display) the master datagridview and each of the corresponding detail datagridviews. My legacy application already has printing capability so I'm trying to use that. I've created an array of the datagridviews and printed them, but all the detail datagridviews are the same because they were copied by reference.
Any help is welcome.
Try using:
currencyManager = (CurrencyManager)dataGridView1.BindingContext[data];

change database table content with datagridview on real time

i address u all cause im a bit confused of what the course of action should be in this scenario.
I want to do the following in a application im currently building, i wish to show content from a table in my database on a datagridview i have in my form, and id like the changes made by the user in this datagridview be also made in the table from the database.
now i ve read a few articles about databinding but i am not sure if it works for this scenario, or as how to use it since i ve never used databindings before.
Can this be done with bindings, or should i just check for changes in my datagridview and send those changes to the database?.
Thx in advanced for any answer u can give me, i realy need some guidance in this.
This can be done automatically:
Project > Add New Data source > Select Database > select table(s).
View > other Windows > Data sources.
Go to the Data sources box that shows up > select your table > select DataGridView from the drop-down next to table name > Drag your table to your form's designer.
Now you get exactly what you want, the user can change data in the DataGridView and save the changes to the database with automatically generated binding and (New, Save , Delete ) buttons.

make an interface with datagrid

I am making a windows form application, a billing software. I want to make a interface like this on one of the forms:
There is a row of textboxes with about 5-7 textboxes, i fill the first textbox with a product ID which automatically populates the rest of the textboxes fetching data from appropriate tables and automatically generate a new row of textboxes, the first textbox from the new row being focussed for entering product ID. It should continue until i click a certain button which finalizes the bill. On clicking this button all these values should be updated to database in respective tables. How can I achieve this?
Can using datagrid help?
Google "C# write to database" and click on one of the links, like these that came up when I did it:
http://www.codeproject.com/Articles/3554/Simple-Database-Application-Part-1
http://www.codeproject.com/Articles/1155/Simple-ADO-NET-Database-Read-Insert-Update-and-Del
Or go to amazon.com and search "c# database" and buy one of those books.

Update a data row inside an asp.net Data Grid View

I think it would be easier for you to understand my problem if I explain the scenario a bit.
What I am doing is developing a system to a doctor using asp.net c#. For the creation of the prescription, I add a check box list for the list of medicines and submit button below it. When the submit button clicked selected check box list items added to the sql server database and show a data grid with the selected medicines in the same page.
In the data grid there are two columns for medicine name and dosage.Medicine name is taken from the database.I need to give the user the ability to enter the dosage through that grid view. I need to use update command because the record is already there in the sql server.But empty value in the dosage column.I tried to use update command in the data source control. But I can't figure out how to give the WHERE clause because I can't specify the database row which the updating record relate to.
I would be glad to hear some help from you. All the comments are welcome.
You need to set a parameter(s), please check this example to understand how it works. I guess, that you've added in the database some column that is unique identifier.. some autoincrement int or guid.

How to display value from SQL Server database in input box?

I would like to do something like simple data binding in Windows Forms, but in Web Forms. So I would like to get data from a column NAME from table CATS (one row) and display in on website in text box (input type='text') and next I would like to click on "save" button to save this data to database doing an update.
Could you please give me a short snippet of how should I do it to work and get understanding of how does it go?
Really easy updating can come through the detailsview control: https://web.archive.org/web/20211020133929/https://www.4guysfromrolla.com/articles/050207-1.aspx

Categories

Resources