Hi all,
I've got a form with a datagrid defined & presented to the user at
runtime (code at the bottom.) With this, the user can happily enter
all the data she likes. After a row of data is entered in the
datagrid, and the datagrid is about to start a new row for the user,
I'd like an UpdateDatabase( DataRow rowJustEntered) to be called.
I suppose some kind of define-and-subscribe-to-some-event has to take
place, but that's precisely the sort of thing I don't understand so
well.
How can I do this? I'm imagining the database update routine to be
centered around an InsertCommand.E xecuteNonQuery( ) call.
Thanks for any help,
cdj
=============== ===========
//manualForm is a Form with a DataGrid on it,
//and has already been instantiated.
DataSet manualDataSet = new DataSet();
manualDataSet.T ables.Add("tabl e");
manualForm.data Grid.SetDataBin ding(manualData Set, "table");
manualForm.Widt h = 300;
manualForm.Star tPosition = FormStartPositi on.CenterScreen ;
DataTable theTable = manualDataSet.T ables["table"];
DataColumn colIndex = new DataColumn("ind ex",
System.Type.Get Type("System.In t32"));
DataColumn colDate = new DataColumn("dat e",
System.Type.Get Type("System.Da teTime"));
DataColumn colData = new DataColumn("dat a",
System.Type.Get Type("System.Do uble"));
theTable.Column s.Add(colIndex) ;
theTable.Column s.Add(colDate);
theTable.Column s.Add(colData);
colIndex.AllowD BNull = false;
colDate.AllowDB Null = false;
colData.AllowDB Null = false;
DataColumn[] keyCols = {colIndex, colDate};
theTable.Primar yKey = keyCols;
manualForm.data Grid.ColumnHead ersVisible = true;
manualForm.Show (); 1 1351
On Jan 30, 2:54 pm, "sherifffruitfl y" <sherifffruit.. .@gmail.com>
wrote:
Hi all,
I've got a form with a datagrid defined & presented to the user at
runtime (code at the bottom.) With this, the user can happily enter
all the data she likes. After a row of data is entered in the
datagrid, and the datagrid is about to start a new row for the user,
I'd like an UpdateDatabase( DataRow rowJustEntered) to be called.
I suppose some kind of define-and-subscribe-to-some-event has to take
place, but that's precisely the sort of thing I don't understand so
well.
Nevermind. lol! Woohoo! Figured one out on my own!
manualDataSet.T ables["table"].RowChanging += new
DataRowChangeEv entHandler(Upda teManual); This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Steve B. |
last post by:
I have a DataGrid on the left and TextBoxes (TB) on the right. The TB's
reflect the contents of the grid cells.
Sorting of columns (both thru VS and programmatically) work fine except,
when the form/grid first opens up and the grid is immediately sorted the TB
don't reflect the sorted data of the First row of the grid.
Note: Initially the black grid indicator arrow points to the first row. If
the user choses another row and then sorts...
|
by: Dave |
last post by:
Tried posting in the Winform Forum without much luck, so posting here...
After inserting a new data row to a DataTable that is bound to a
datagrid, I am unable to change data in a row that is after the newly
added row without getting bizarre results.
I have added the full code for the test below. Create a project drop
in the code and run. There is nothing crazy about the code. I used
the designer to add the dataset and to do the...
|
by: 23s |
last post by:
I had this problem in the past, after a server reformat it went away, and
now after another server reformat it's back again - no clue what's doing it.
Here's the flow:
Website root is public, no SSL no forms auth. One of the subfolders in the
public area is the root of a "protected" area; SSL is required from this
subfolder on forward and a web.config in the subfolder specifies forms
authentication. From the public area, I provide a...
|
by: Antonio |
last post by:
Hi, we are trying to create a page for our users that contains a lot of
data. One datagrid loads very slow because the query behind it is
complex. We would like to load up the page to the user with the
information that returns fast right away and let the data grid take
it's time to load (about 10 seconds). But we don't want the user to
have to click something after the page loads to start the query . we
want the page_load event to...
|
by: Ron L |
last post by:
All
I am working with a DataGrid and a form consisting of a number of text,
checkbox, combobox controls, all bound to the same datatable. When I click
on my "New" button, I create a new row, make it the current row, and allow
the user to make changes in the form. If the user desires to cancel, they
can click the "Cancel Changes" button. Here is where my problems start.
Once the Cancel Changes button is clicked, the bindings on the...
| |
by: Kuljit |
last post by:
I am doing Engineering(B.Tech) in Computer Science.
I have a question for which i am struggling to write a C code(program).
It struck me when we were being taught about a program which counts the
number of digits in a given number.
I request to help me out in solving the below said question.
Ask the user to enter a decimal/float number(eg. 32.8952), then count
the number of digits in that number after the decimal point(4 in this
case).
|
by: Gidi |
last post by:
Hi,
I have a DataGrid cell which the user enters dates to it.
i want that after the user has entered 2 digits (dd) a "/" will be entered
automaticly, and then after the 2 next digits another "/" will be entered. so
at the end the date will be dd/mm/yyyy.
I know how to do it with KeyUp Event, but since i have a problem and only
the KeyUp event doesn't work on my cell (The KeyDown,KeyPress are working), i
have to find a different...
|
by: benfly08 |
last post by:
Hi, everyone.
I got a weird problem for my C# program. In my program, I use a DataGrid to display data. I bind the DataGrid to a DataTable. I made all the cells in DataGrid ReadOnly as True. So I can only Click on the cell but not change them.
Now, after I display the data, I clicked on one cell, then I clicked a button which will *virtually* go to the other form.(The reason why I said *virtually* is because I only use one form for...
|
by: slinky |
last post by:
I have a textbox that a user enters the current time (in this case at
the end of a task, and it gets its value via a button's click event
and getting its value from =Now() ).
Is there a way to LOCK this textbox's value once the user hits the
button that posts the time. I tried to make the button invisibe right
after the button is hit, but I get an error.
Anyone got any clues for revision? Thanks! Here is my code:
Private Sub...
|
by: slinky |
last post by:
I found the following code to transfer datagrid data to an Excel file.
Is this written in C#?... I'm a vb.netter. I'm just not sure where to
place the code to experiment on it. Should I place it in the event
handler for a form button. Is there other ways to accomplish this? I
looked at some on the web and usergroups, but was confused as to the
functioning. BTW my datagrid is enclosed in a <div></divfor ease of
scrolling if that would...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |