|
well, Tab is a character like any other, no strange thing about it.
If you want to be absolutely sure about the ascii code, try this :
char test = c1[3];
int test_ascii = Convert.ToInt32(test);
MessageBox.Show(test_ascii.ToString());
Write down the number the MessageBox will show, then back to your replace code, use :
int the_number_you_got;
my_string.Replace( ((char)the_number_you_got).ToString(), String.Empty);
Etienne.
|
|
|
|
|
Yes it's working now thankz so much for the help
will be coming here to post question again when i start on the reading and comparing of xml data wif .txt data
|
|
|
|
|
Yes it's working now thankz so much for the help
will be coming here to post question again when i start on the reading and comparing of xml data wif .txt data
|
|
|
|
|
I have an application that reads the registry value and diplays result in a textbox (Using Microsoft.Win32 namespace). It works fine as long as I know the registry name. Here is my problem:
1. I have a subkey name MyKey (HKLM\SOFTWARE\MyKey)
2. The key will have one or two subkeys but I do not know their names(lets call them KeyX, KeyY)
3. Every unknow key (e.g. KeyX)has a string value that I want to read
serviceName 12345
Any ideas how to do this?
|
|
|
|
|
You can call GetValueNames() to retrieve the names of the values and GetSubKeyNames() to retrieve the names of the subkeys.
Yes, even I am blogging now!
|
|
|
|
|
|
Hi all,
I have a byte array need to change it into an array of hex then to a string,
having difficulty allocating this problem. Is there any solution?
Thanks
|
|
|
|
|
I’ve run into a problem while using a c# property grid with custom property editors and would appreciate any help. Bear with me as this may be a little difficult to explain.
The situation is as follows:
I have multiple objects selected in the property grid and they are of the same type. I have a custom modal editor defined on a property of this type. The editor works in every case except the following: if the property for any of the objects is null and not null for the remaining objects and my custom modal editor sets the value to null, a property value changed event will not be fired. This only happens when setting to null in exactly these circumstances. My feeling is that it has to do with the fact that when multi-selecting objects with different property values (for the same property) the region for that property is emptied out (same as null representation) and when it attempts to set the value to null it believes that there is no change to be made, even though many of the objects need to be changed.
Anyway, I hope that made sense and like I said any help would be greatly appreciated.
-Darryl.
|
|
|
|
|
I have been searching all over trying to find some easy good network code examples.
Basicly, I am creating (Only for learning purposes) a simple card game. I have the client side pretty much finished, trying to get the server working. My goal was to have 2 games going at once (Seperate timer for each). After 10 seconds (For that game), it will switch to the next players turn if they didn't select any cards.
What I can't figure out, or find anywhere is a good example of code that shows how a request from 1 client, can be forwarded to another client. Another thing would be for the "game timer" to tell all the clients in that game a players turn was skipped.
Even a simple example of a "telnet chatroom" would work. Multiple clients connect to the server, then all messages are forwarded to all connecting clients would be a step in the right direction.
I am fairly new at C#, with a primarly Perl / PHP background. So, please go easy on me :P
|
|
|
|
|
Are you using remoting ?
If you are, then you can't really send a message from one client to another.
Just pass it through the server.
When it's player 1 turn, server calls
client_1_proxy.TimerStart();
When player 1 clicks client calls :
server_proxy.Played();
Or if the 10 seconds run out :
server_proxy.TimeOver();
Then server checks whoses turn it is, and go over with client_x_proxy.TimerStart()...
It will probably be easier to go with persistant server object, so you don't have to store game state in a file or something.
Etienne.
|
|
|
|
|
Yes, that is what I planned on doing. The server is going to reply the messages, because the server still needs to verify that its a vaild move.
The timer code, I can figure out for the most part. The main issue I need help with, is the network code it self. I have a few examples, some using threads, some note. Some have like 5 different classes, some less.
I need to be to keep track of multiple (Persistant) connections. When the server decides to change the game state (Player moves, players skipped, etc) it needs to let all clients, or only some clients in that game know. (My longer goal was to run 2 or more games at once)
I figured having a seperate class to define the game state information. Client "id"s that are connected, which players have which cards, last card dropped, which players turn it presently is, etc. Then have a timer that interacts with that class. This timer is only for this game instance. When the state changes, it doesn't affect other games.
I hope that explains what my goal is a little more.
|
|
|
|
|
I have the disc, installed it, but can't find any samples anywhere ? Where are they ? Or if there aren't any, where can I find some on internet ? I tried the ones that are built for Longhorn but they won't compile as the CTP (for XP) has some fundamental changes in it (like namespace changes, some features cut-off and so on).
Regards, Desmond
|
|
|
|
|
Hi,
I have an application where I dynamically build a form based on a selection made in a database tree. All controls added to the form are docked at the top. It all works except for the speed. I am using the suspend and resume layout but that still doesn't address the drawing speed. All my controls are also built using the default windows control.
Does anyone know why the controls are so slow to add to a form dynamically?
Is there anything I can do?
Thanks!
|
|
|
|
|
|
I'd suggest sending a WM_SETDRAW message to stop redrawing the form while you're adding the controls.
Another simpler suggestion (and, depending on your code, can give performance enough) is doing all the manipulation on the controls before you call Controls.Add, so it'll minimize redrawing.
BTW, 99% of the "slow dynamic controls" posts I answer here are performance problems within the generation of the controls, i.e., in your data access code, and not a .NET framework performance problem.
Yes, even I am blogging now!
|
|
|
|
|
Thanks I will the WM_SETDRAW.
As for doing the manipulation before the controls.add, it turns out I use the AddRange and all the controls are ready before the AddRange.
I did some test without any data access, just the actual creation of the control and no speed improvement in my case. Granted I have some methods that go fetch the appropriate control for the data I am viewing but it only loops through a dozen controls at the moment.
The application is usable but I see the drawing of the elements as they get added to the form. I thought that the SuspendLayout and ResumeLayout would take care of that.
|
|
|
|
|
to make your own easily couldn't you just make a tabpage, edit everything hide the buttons, and add some pics to make it look like its static and couldn;t you just set the next page when the next is displayed?? is this how it works or are there other tricks.
IM PROUD TO BE A GMAIL;
|
|
|
|
|
|
Greetings, all!
I'm trying to change the background color on a TabControl, as you may have guessed from the subject. I see that it inherits from Control, which has a BackColor property, but that property doesn't seem to be exposed in the TabControl. I can change the BackColor for the individual TabPages in the control, but unless I can change the TabControl's BackColor, it looks terrible.
So, the question is, how do I change the BackColor (and ForeColor, for that matter) in a TabControl?
|
|
|
|
|
P.S. I tried casting the TabControl to Control, and setting the BackColor on the cast. No luck.
|
|
|
|
|
Hi
How are you?
I need to hide certain properites of an object when i change a property value e.g.
enum ObjType
{TypeA,TypeB}
public ObjType Type
{
get {...}
Set {...}
}
As i change value of Type Property of an Object i want to hide some browsable properties or show some browsable(false) properties
C#
|
|
|
|
|
|
Sorry
i need to dynamically hide and show properties in the property grid at run time
like using attribute browsable false and true
|
|
|
|
|
I needed to do something similar. You'll need to implement the ICustomTypeDescriptor interface (here's an article that shows how).
In ICustomTypeDescriptor 's GetProperties() method you can set which properties will show up in the PropertyGrid (see my articles demo source for an example).
So using your example, you could do something like:
TypeACustomTypeDescriptor typeATypeDescriptor = new TypeACustomTypeDescriptor();<br />
TypeBCustomTypeDescriptor typeBTypeDescriptor = new TypeBCustomTypeDescriptor();<br />
<br />
public ObjType Type<br />
{<br />
get {...}<br />
set <br />
{<br />
if (value == ObjType.TypeA)<br />
{<br />
PropertyGrid.SelectedObject = typeATypeDescriptor;<br />
}<br />
else<br />
{<br />
PropertyGrid.SelectedObject = typeBTypeDescriptor;<br />
}<br />
}<br />
}
"I think I speak on behalf of everyone here when I say huh?" - Buffy
|
|
|
|
|
Hi
Sir How are you ?
Thank alot it works as i needed
thank you again
best wishes
Ali
VC++,COM ,C#
|
|
|
|