|
i want to delete selected row by pressing delete button on keyboard ...also i want to know the evet when deleteing row on datagrid ...
|
|
|
|
|
hi,
You can't delete a row from datagrid( datagrid row). What you can do is, when user hit the delete key then can delete one record from the data source ( Datatable or view) which use to show the data in datagrid and then you need to re define the datagrid's datasource.
Write your logic in datagrids keydown event.
if(e.KeyValue== Keys.Delete)
{
}
Better if you go through Datagrid HitInfo or HitTestInfo methods.;)
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
I want to serialize a private field of a class:
...
private ArrayList items = null;
...
XmlSerializer serializer = new XmlSerializer(typeof(MyClass));
TextWriter writer = new StreamWriter(path);
serializer.Serialize(writer, this);
writer.Close();
the items array is serialized only if change it to public, but I do not want to do this.
items are presented by the class through some properties, each making some work before
returns something; the basic form of items should not be visible.
Any solution?
|
|
|
|
|
I'm not sure why you're using the XML serializer for this, but here goes...
XML serialization is not designed to access private class members. If you want to force XML serialization to store private class mambers, you may be able to do so using the IXmlSerializable interface see here[^] for a little more info.
If XML serialization is not a requirement, you might consider binary serialization. There's much better support for customizing the serialization process built into the framework (and documented).
Good luck.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
I choose XML serialization because I need a text file, which can be edited if needed. If other methods give me a text format it would be OK.
|
|
|
|
|
When I try printing line contains "\t" tab the printer is not printing it, Why and what's the solution?
Thanx.
Devil Linux
|
|
|
|
|
hi,
You can refer this aricle and it is good enogh to print string in C#.
http://www.c-sharpcorner.com/winforms/texteditor.asp
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
hi,
I got your reply. After getting the entire content (printing content) we are assigning it to the PrintDocument component.
printDocu.Document=this.richtext.text
This point of time the PrintDocument component will treat the entire content as printing content.
In this situation if you try to use \t or \n it will treat as printing characters and nothing else.
The reason is simple there is no direct relation between our printer and CLR. Onece you give this \t or \n then our CLR know what to do once it's found that sort of carriages.
But it is mot applicable with printer (upto my level best ).
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
I can get my local IPv6 address in Win2003 use the source code as below:
string localName = Dns.GetHostName();
string address = "";
string scopeId = "";
IPHostEntry hostEntry = Dns.Resolve( localName );
foreach (IPAddress curAdd in hostEntry.AddressList)
{
if(curAdd.AddressFamily.ToString() == ProtocolFamily.InterNetworkV6.ToString())
{
scopeId = curAdd.ScopeId.ToString();
address = curAdd.ToString();
break;
}
}
Then, I set the config about IPv6 in WinXP as the same as Win2003. when I run the source code in WinXP, I can only get the loopback(::1) address but not local IPv6 address.
Thank you for your help!
|
|
|
|
|
|
thank you .
Here is my sequence to setup IPv6 in WinXP:
1、Open the propertiy of local connection, add the McroSoft IPv6 protocol
2、Start a command prompt window and type "ipv6 install"(Window XP).Then I check this by typing "ipconfig/all" at the command prompt, IPv6 address OK
3、Open the machine.config file that is located in the .NET Framework CONFIG directory (on Windows XP it is located at
C:\Windows\Microsoft.NET\Framework\v1.1.XXXX\CONFIG) . Change the XML tag:
to:
<ipv6 enabled="true">
This allows the framework to parse and resolve IPv6 addresses.
DNS need setup in my PC?
|
|
|
|
|
In my C# winforms datagrid, how do I get the value of the selected cell?
|
|
|
|
|
hi,
I wrote an article which contain solution for this queary. Please refer that first. If it is not serving your purpose then please let me know.
http://www.codeproject.com/csharp/Apply_DataGridTableStyle.asp
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
in this code I know the current item index is "y" Code1:
<br />
for (int y = 0; y < 1000; y++) {<br />
}<br />
How I do to know the current item index? Or I need use the Code3? Code2:
<br />
string[] strArray = new string[........]<br />
foreach (string y in strArray ) {<br />
}<br />
Code3:
<br />
string[] strArray = new string[........]<br />
int x = 0;<br />
foreach (string y in strArray ) {<br />
x++;<br />
}<br />
If I need of Code3 to obtain the current index, then is better use the Code1...
Sugestions?
Thanks in advance!
|
|
|
|
|
AFAIK Code 1 is better, because no slow enumeration methods are called.
If you know the count of items in a list (and you always know Array.Length), use an index.
|
|
|
|
|
I want to get all file name in main directory of remote server,but I don't know how to design the code. Can you help me? Thank you!
|
|
|
|
|
There's a vast amount of different ways you can follow, mainly depending on the remote server and your access rights there.
You could use UNC paths, if the directory is accessable this way (Directory.GetFiles(@"\\MyServer\MyShare", "*") ).
You can use a server program running on the remote server, listening for requests on a port and then returning the directory contents.
You can make life easier by using .NET remoting to access this server program.
(...and many other ways...)
Pick one.
Regards,
mav
|
|
|
|
|
Thanks for your help! But I'm a beginner,and I know little about programing.Can you tell me more about it? Thank you!;);)
|
|
|
|
|
I need to use Ms chart to plot a graph in c#. however i dunno how to use. Anyone willing to help me?
|
|
|
|
|
hi,
I posted same question in codeproject. I searched lot of Microsoft shelf's and coludn't able to find any documentation.
Upto my level best Microsoft Corp didn't released any documentation which deals how to use MSchart control in .NET Application.;)
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
In the IDE, you can reformat a file, or selection thereof, using Edit|Advanced|Format Document (or Format Selection.) This is great except I want to prevent it from reformatting one section of a file where I have everything organized neatly by columns.
Is there a directive of some sort to prevent the IDE from reformatting certain sections of a file?
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
No, not in Visual Studio. If you don't want to format a certain selection, though, don't select it and use "Format Selection".
You might consider googling for Visual Studio add-ins. There is one that advertises here on CodeProject (the name escapes me, and it's not the current banner) that may do what you need. Whether you can prevent sections from being formatted to me is unknown.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Visual Studio 2005 won't reformat the layout of your code.
- Nick Parker My Blog | My Articles
|
|
|
|
|
I'm actually using both VS 2003 and 2005. 2005 won't auto-reformat but it will reformat the code section if you go to Edit|Advanced|Format...
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
I was referring to it not auto-reformatting the code, a nice change.
- Nick Parker My Blog | My Articles
|
|
|
|