|
if ur using any database the u can store it in table at the time of closing application
or u can use Xml file to store ur content.
rahul
|
|
|
|
|
It would be REAL handy to know what type of application you're talking about, but I'm assuming a Windows app.
Generally it would be really easy to save the contents to a small XML file, then at startup check to see if that file is present. If it is, put the contents back in the listbox, and if not, it would be empty.
HTH
WhiteWizard
aka Gandalf
|
|
|
|
|
Hello every 1
Can any 1 tell me if there is a .NET control / library that can be used to create trees (preferably binary)on WinForm in C# application.
I have seen tree at cp that are vertical but i want tree that grows horizontally.....
any suggestions are welcome....
o O º(`'·.,(`'·., ☆,.·''),.·'')º O o°
»·'"`»* *☆ t4ure4n ☆* *«·'"`«
°o O º(,.·''(,.·'' ☆`'·.,)`'·.,)º O o°
|
|
|
|
|
Hi,
I have a basic doubt in using a switch case.
For the case stmt am unable to have a static or readonly value. The compiler gives a error "A constant value is expected".
i.e, if i have a variable like - private static myval = "R1";
--
switch
{
case classname.myval: // gives compiler error
}
Would be much happy to know the logic behind this.
Thanks.
|
|
|
|
|
He is Cool wrote: switch
{
case classname.myval: // gives compiler error
}
in switch steatement you should set any value .
|
|
|
|
|
yup. i am giving a static value.
|
|
|
|
|
|
Yeah, that was definately a thinker...
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
switch is pretty much limited to constant values. The value needs to be known at compile time. myval can be changed in the code, so it will not always be the same.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
|
He is Cool wrote: Would be much happy to know the logic behind this
Only constants are known at compile time. The value must be known at compile time for it to generate a valid switch statement.
With a static the value can be changed at any time during the run of the program. With a readonly the value is set at runtime, although it cannot be changed once set.
So, you can only provide a constant value. Either a literal value or something set as a const , just as the compiler says.
|
|
|
|
|
Hi,
I'm new to C#. I need your help with regard to the PropertyGrid.
I want to have a PropertyGrid for my class "Car" which has the category details of engine, wheels and framework. How do I create create categories and their respective fields like Category Engine - Type, Name, HP and so on?
|
|
|
|
|
Hi,
You have to decorate your properties with the CategoryAttribute attribute. In your Car class:
<br />
[Category(Engine)]<br />
public EngineClass Engine<br />
{ get ; set; }<br />
If your EngineClass contains all the fields you want to display, then use a TypeConverter that will expand the Engine node, like ExpandableObjectConverter or a derived class of it:
<br />
[TypeConverter(typeof(ExpandableObjectConverter))]<br />
public class EngineClass {<br />
...<br />
Hope that helps.
|
|
|
|
|
There are three textboxex. I have given values in textbox1 and textbox2 as 10 and 20. if I hit the enter key not tab control the sum of two textboxes(30) will be displayed in textbox3. How can I write on client side using javascript? if anyone send code its nice.
thanks,
Hosanna.
|
|
|
|
|
I recommend the web dev forum for this.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi all,
I am working with Direct show in C#
I want to play a live stream from a link.
the link consists of a .asx file
I am able to play a saved .asx file but the live link is not working
How do i do that?
Thanks & Regards,
Pramod
"Everyone is a genius at least once a year"
|
|
|
|
|
Hi Thanks
Iam new to using win32 API for serial communication.
Plz help me
I want to send one string("Hello") to COM port
port is COM2
baud rate 9600
parity None
Data bit 8
Stop bit 2
Now I want write program in C#.net 2003 and framework1.1
Plz give me a small program for this (you can assume after click button the data should be send)
It’s more useful in my application
Plz
Thanks
|
|
|
|
|
hi
i found an article in codeproject as DataGridPrinter that print datagrid good. but it has written with VB.Net and i want it in csharp. when i create dll in VB.Net and i use it in c# the following error shown me :
Unable to cast object of type 'System.Windows.Forms.BindingSource' to type 'System.Data.DataTable'
and when i set Datagrid1.DataSource = ds1.Tables["Table1"]; the following error shown me :
//in Line 374
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
how to solve my problem and do you have a other class that print datagrid in C# with header and footer ?
thanks ..
|
|
|
|
|
How to read a exact line from .txt file.
Example:"FileName.txt", line 15.
Vasildb
|
|
|
|
|
File.ReadAllLines will read your file into a string array. Then you can use index 14 to read the 15th line.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi,
I'm starting with C# and the VS2005 and got some trouble with the DataGridView element.
I have designed a simple form with an DataGridView and bound the grid to MS access database file (*.mdb) via the VS2005 Designer.
If I start the application and open the form, the DataGridView will open and filled correctly with the included data inside the database file.
When I edit some rows or add new rows the changes will stored inside the generated Dataset, I believe, because if I close and reopen the form the changes will displayed correctly.
But if I close and restart the application the changes are lost.
So I put a Save button to the form and the devicesTableAdapter.Update(this.aStreamsDataSet.Devices); inside it's handler. But also the information doesn't store to the database.
On further test I saw that if I add a new row to the DataGridView the 'count' will increment inside the DataTable.
If I edit some existing rows the 'rowChanged' is always null inside the DataTable.
Do I have set special properties of the DataGridView? It's only displaying availlable or what else?
Did you know a simple instruction to use this control for editing the data also?
I'm glad for every suggestion.
Thanks a lot
Alex
|
|
|
|
|
Hi,
i guess you have to give the dataset with changes in the update method from the adapter.
you can get them by using getchanges on your current dataset..
also fill in the delete-, insert- updatecommands on the adpater .. its possible using a commandbuilder for it...
hope this helps..
greetz
Kurt
|
|
|
|
|
Hi Kurt,
I had a look to my automatic generated adapter the following and find the following commandstrings/SQL-statements. May you could say if this statements are correct? Will the question mark replace on code execution or are this default/sample entries which doesn't work?
1.) this._adapter.UpdateCommand.CommandText = @"UPDATE `Devices` SET `Name` = ?, `IPAddress` = ?, `Type` = ?, `Subtype` = ?, `Status` = ?, `Comment` = ?, `Activate` = ? WHERE ((`ID` = ?) AND ((? = 1 AND `Name` IS NULL) OR (`Name` = ?)) AND ((? = 1 AND `IPAddress` IS NULL) OR (`IPAddress` = ?)) AND ((? = 1 AND `Type` IS NULL) OR (`Type` = ?)) AND ((? = 1 AND `Subtype` IS NULL) OR (`Subtype` = ?)) AND ((? = 1 AND `Status` IS NULL) OR (`Status` = ?)) AND ((? = 1 AND `Comment` IS NULL) OR (`Comment` = ?)) AND ((? = 1 AND `Activate` IS NULL) OR (`Activate` = ?)))";
2.) this._adapter.InsertCommand.CommandText = "INSERT INTO `Devices` (`Name`, `IPAddress`, `Type`, `Subtype`, `Status`, `Comment" + "`, `Activate`) VALUES (?, ?, ?, ?, ?, ?, ?)";
3.) this._adapter.DeleteCommand.CommandText = @"DELETE FROM `Devices` WHERE ((`ID` = ?) AND ((? = 1 AND `Name` IS NULL) OR (`Name` = ?)) AND ((? = 1 AND `IPAddress` IS NULL) OR (`IPAddress` = ?)) AND ((? = 1 AND `Type` IS NULL) OR (`Type` = ?)) AND ((? = 1 AND `Subtype` IS NULL) OR (`Subtype` = ?)) AND ((? = 1 AND `Status` IS NULL) OR (`Status` = ?)) AND ((? = 1 AND `Comment` IS NULL) OR (`Comment` = ?)) AND ((? = 1 AND `Activate` IS NULL) OR (`Activate` = ?)))";
If I debug my code I saw the this.Adapter.Update(dataTable); methode will called, but it doesn't work.
Next I try to check the getchanges().
Thanks alex
|
|
|
|
|
I'll guess the query will be ok ( but i don't have qoutes around the fieldnames) and yes the question is replaced by the given parameter value.
Maybe better to define your own query and use less fields in the where clause.
try this :
Tmp_datatable = yourdatatable.getchanges();
this.Adapter.Update(Tmp_datatable);
Tmp_datatable only has the modified rows
greetz.
|
|
|
|
|
Hi,
I put the code inside and also debug them, looks like your sample;
try<br />
{<br />
if (this.Validate() == false){<br />
MessageBox.Show("Validation is false verify your input!");<br />
return;<br />
}<br />
this.devicesBindingSource.EndEdit();<br />
VideoStreamsDataSet.DevicesDataTable Tmp_datatable = new VideoStreamsDataSet.DevicesDataTable();<br />
Tmp_datatable = VideoStreamsDataSet.DevicesDataTable)this.videoStreamsDataSet.Devices.GetChanges();<br />
this.devicesTableAdapter.Update(Tmp_datatable);<br />
MessageBox.Show("Update successful");<br />
}<br />
catch (System.Exception ex){<br />
MessageBox.Show("Update failed");<br />
}
If I add a new row the values will update and displayed at the DataGridView. But also if I close the application and restart, I could see the data isn't stored at database.
If I modify a row so I catch an exeption calling me this:
Parallelitätsverletzung : Der UpdateCommand hat sich auf 0 der erwarteten 1 Datensätze ausgewirkt.
means:
parallel violation: The UpdateCommand has got 0 of expected 1 data record affected.
Did you have some idea or maybe some complete smale sample that's works correct. I'm much more than frustrated.
Thanks alex
|
|
|
|