|
How do you add a row to the datagrid, this is what we are struggling with
|
|
|
|
|
i don't think that you can a row to a grid without adding the row
to the datasource.
so what ?? what is the data source
Tamimi - Code
|
|
|
|
|
assuming: DataGrid dg, DataTable dt
DataRow newRow = dt.NewRow();
newRow["column1"] = value1;
newRow["column2"] = value2;
...
dt.Rows.Add(newRow);
Hope this is correct and hope it helps.
I've recently started to use C# to connect to SQL server -- so have been trying to learn all these methods of adding, updating, etc. Also, it appears to me that the Windows.Forms class DataGrid certainly was not given the attention that the web class DataGrid was. I'm finding several features that could be improved.
Also, if you're "struggling" with the above, I found the following book helpful for me -"Mastering C# Database Programming" by Jason Price. Some reviews were not so kind, but it has been very helpful and very clear for me.
Good luck!
John
|
|
|
|
|
Sorry... didn't finish the code from above.
after adding the newRow to the DataTable (dt), you need to add the following to update the DataGrid (dg):
dg.DataSource = dt;
John
|
|
|
|
|
--------------------------------------------------------------------------------
Can someone help me in making a barcode checking in C programming language? The barcode is using EAN-13 code, which was normally grouped as 1-6-6. The code should check code like 9 300605 013278, and print out a message whether it's a valid barcode.
The requirement for a valid barcode is that:
• Add up all the even-numbered digits, and multiply the sum by 3:
3 + 0 + 0 + 0 + 3 + 7 = 13; 13 * 3 = 39
• Add up all the odd-numbered digits (including the check digit):
9 + 0 + 6 + 5 + 1 + 2 + 8 = 31
• Add up the two totals; the result should be divisible by 10:
39 + 31 = 70
Thanks and cheers for the help!!
|
|
|
|
|
llyod wrote: in C programming language
Wrong forum.
By the way the problem you present requires only simple mathematics and it shouldn't be that hard to code this by yourself.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
See here[^] maybe it is some helpful to you
|
|
|
|
|
Hi
I would like to create windows service for an application in c#.Basically, I have done like this. I make a function to send mail, function name sendMail () in class1.
Now, I have added one project WindowsService1 in existing application. In a WindowsService1 project,
I have written code on start() event in service1.cs. Just I made an object of calss1 and call the function SendMail. Service is successfully installed but not starts.
I am trying to start service but unable to start service. One message is displayed like this
“The Mailer service on Local Computer started and then stopped. Some services stop automatically if they have no work to do, for example, the Performance Logs and Alerts service”.
Actually, I have some queries regarding windows service.
1) Can I call any function on OnStart () event in Windows service project.
2) How to mange windows service OnStart () event and OnStop () Event?
Any help is appreciated
Regards,
Rajesh
rajesh
|
|
|
|
|
i want to set mediaplayer start my sound at specific position,
there is this code :
axWindowsMediaPlayer1.Ctlcontrols.currentPosition
but it is readonly , and i couldnt set it !!!
|
|
|
|
|
I found it myself , it was easy , just with using following code:
axWindowsMediaPlayer1.Ctlcontrols.currentPosition = 90;
90 is 1:30
|
|
|
|
|
I want to show the log file to the user. the file size could be approximately 100 kb and the file can have hundreds of lines in it. What are the possible ways to show that file to the user by highlighting the lines having 'Error...' in it. I also want to do it efficiently so that the parsing can't affect the speed of the application.
sAqIb
|
|
|
|
|
I think your best bet would be creating a simple form with a RichTextBox inside. There should be many code examples, tutorials and/or articles in the internet that cover syntax highlighting with RichTextBox.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
dear programers
in sqlservr database i made field type 'nvarchar' and 'ntext' does not work.
how can i Encode and Decode the utf-8 characters so that i can easly save to database
sikandar
|
|
|
|
|
Standard question #1:
What do you mean by "not working"?
If you have a text saved as UTF-8, you can load it with a StreamReader using the Encoding.UTF8 encoding. When you read a string from the stream it will be decoded to Uncode, that you can store in the database.
---
b { font-weight: normal; }
|
|
|
|
|
HI
i am new in c#
plz tell me
how to define the below in c#
struct link
{
int info;
link *next
};
struct link *start=new link;
Parshant
|
|
|
|
|
Well, you can't have a pointer, so
struct link
{
int info;
link next
};
struct link start=new link();
You don't want to be writing linked list classes tho, you should just use the ones built into the framework.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
sir plz tell me how with abov e.g
|
|
|
|
|
I don't understand - I converted your struct to C#, what else did you need ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I guess he tried to compile your code and it failed. It doesn't work because you're trying to create an instance of the struct as a member of the very struct you're defining, so it becomes kinda like an infinite recursive definition.
|
|
|
|
|
Structs works differently in C# than in C. In C# a struct is a value type and a class is a reference type, while in C a struct is just a definition and the type depends on how you use it.
As you want to have references to your objects you would want it to be a reference type, so you use a class:
class Link {
public int info;
public Link next;
}
Link start = new Link();
---
b { font-weight: normal; }
|
|
|
|
|
Good point
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
How to create report in VS.Net 2003 using C#
namita dang
|
|
|
|
|
How to create report in VS.Net 2003 using C#
Jitendra Tyagi
|
|
|
|
|
|
Hello
how to make image transparent in Win Appl in c#.NET so that I can see controls behind it,what r the properties that I have to changes for it.
Thanking you
Yogesh_T
|
|
|
|