hello... I need to write a simple chat program and I've noticed that there are alot of sample programs here that use socket programing. Most of them have a client program and a server program which listens to the client program and responds back to it. I also found one peer-to-peer program but here's my question:
How do you connect to the server program (or a client/server) when the server is behind the router or some sort of a firewall. I mean I can't type 192.168.etc. as the ip address! So I was wondering if anybody can tell me how a msn-like chatting program works.
Could you help me?? I'm trying to do a simple shift (caesar-like) algorithm. I can get it to shift but once I get to the end of the array, I can't figure out how to return to the first index and keep looking.
Example: plaintext -> abc
shift -> 3
ciphertext -> def
The problem comes when I try to shift one of the last characters in the array any number of positions forward. I get an IndexOutOfBoundsException and all I want to do is start over counting since the first index.
I hope I'm making myself clear.. anyway, here's the code.. thanks a lot!
thanks a lot, it works when going forward, but not on going backwards...
that is, if I want to decipher it. it works shifting from 'b' to 'a' with a -1 shift, etc. but not from 'a' and back to the end of the array...
I am using a property grid to analyze records from a database. In the case where I have an ID that is the key for a different table, I am wanting to show a drop down list. I have gotten it to work where it will display my object because I've overridden the ToString() method, but when coming back the other way (e.g. selecting a different value in the drop down) it is unable to convert from the string back to the object type that I had). Is there any way to do what I'm wanting? I understand that if all I want is to choose from a list of strings, it would work perfectly, but what I need is to get the ID for that string when it is selected and I need to get the string for that ID when the property drop down is loaded.
Hope that makes sense?
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
You should implement your own TypeConverter in order to enable conversion from string type to integer type and vice versa.
Implementing new type converter is an easy job.
Here is a link to very good tutorial: From MSDN
I've actually used that document (from MSDN) and gone over the examples there several times and I don't see how you would actually convert from an integer to a string. In the example they give under the heading "Adding Domain List and Simple Drop-down Property Support", you'll see that they are only concerned with string types in the list.
If I could guarantee that my strings are always unique (which, in actuality, they probably won't be), then I could just do a reverse lookup to get the integer back when I need to set a value. The exmple they provide in the MSDN doc gives a good way to use strings, but doesn't seem to pertain to having some different corresponding value than what is displayed in the drop down. Is that the section you are referring to or is there some other part you are talking about?
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
Now, to pertain id to its string, obviously you will create an object that have two properties (id and value) and override the ToString() to display the value.
Ok, now if you use standatd listbox control in windows forms application, all objects that you will append to this control will be displayed using the string retrieved by calling to the ToString() method you just implemented.
This leads you to what we call "CustomEditor".
With CustomEditor you can create your own windows form like application to display and manage the property - so create one with listbox control to retrieve the records from the second table and adding them using the custom object you have just created.
The last section in the mentioned MSDN article discusses this issue.
I think part of the problem is that there are multiple forms on this page, and there are 2 Method = "Post". Currently, my error is that I have invalid parameters. Can anyone help me? I'm seriously stuck. Thanks..
how i can include help project files (.chm) in my application without need to install the application?
when i start my application (debug or release mode) the help files and folder doesn`t appear in my appplication (Debug\bin dir) folder. that way, i can't use the help files cause they are located in my root solution folder and not in my main application folder (Debug\bin).
i think the case is the same as a project that contains files not used directly by the application, like a image directory (in another project)not included in the resources, for instance.
You can use post build commands to copy files to your output directory. Under your project's properties, look for the "Build Events" there are text boxes in which you can enter commands to be executed upon completion of a successful build. I would just use a wild card xcopy to move all chm files, image directories, etc. to the ouput directory.
I have been trying to find a way to check file security BEFORE attempting to access a file or folder.
Given the current user and a requested access method, I want to return true or false, whether the user has the given access or not.
With .NET 2.0 I was thinking that this would be provided, but apperently it is not.
Keep in mind, the best way to do this is to just try and open the file. The security checks are done for you, oddly enough - by this very class, at the time the attempt is made to open the file. So, you're not saving any time by doing this.
You can't make just a single control transparent to the mouse using this technique. It's the whole form, or nothing. Alpha-based mouse transparency doesn't work correctly, at least on 2000 and XP, it doesn't.
If you try to make just a control, like a panel transparent, then put it on a form that doesn't support transparency, it doesn't work. The click still works on the control itself. At best, it would fall to the form the control is on.
I understand, you are a great programmer, but I'm also not just a user.
OK, smartass... I never said I was a "great programmer".
You better look up the definition of "opaque[^]". I can't tell what you want from your orignal description. Opaque and transparent are direct opposites of each other. Do you want a control you can see through? That's transparent. Can't see through it? That's opaque.
Which is it?
I posted the link to the article as a POSSIBLE guide to show you how to make an entire form pass through mouse moves and clicks. For you, it wasn't meant to be a guide to the WS_EX_LAYERED attribute.
When you stop insulting people and just answer their questions, I'll take you off my blacklist...
You asked a question and, due to English not being your primary language, worded it using conflicting terminology. I THOUGHT I figured out what you wanted, but instead of clarifying, you decided to insult me. Have a nice life!
Dave Kreskowiak Microsoft MVP - Visual Basic
Last Visit: 31-Dec-99 18:00 Last Update: 28-Jul-16 8:39