Send PictureBox and Chat

If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
8 posts Page 1 of 1
Contributors
GoodGuy17
Coding God
Coding God
Posts: 1610
Joined: Mon Sep 07, 2009 12:25 am

Send PictureBox and Chat
GoodGuy17
Hello,

I have 3 questions.

1. How do I send the Image inside of a PictureBox to someone using my program, and to their PictureBox?

2. How can I transmit text between me and another user?

3. How can I let people enter a username and let that username stick with them throughout their current session, for when they chat, etc...?

Thank you.
User avatar
DreadNought
VIP - Donator
VIP - Donator
Posts: 116
Joined: Fri Jan 08, 2010 12:37 pm

Re: Send PictureBox and Chat
DreadNought
You can transform pictures into bytes which you can send over a TCP Connection and then transform it back to a picture.

You can transmit text into bytes and send it over a TCP Connection and then transform it to text.

Both use the Encoding.ASCII.GetBytes & Encoding.ASCII.GetString methods.

3. Hm?
Bound and boom tech,
The Future Of Coding
GoodGuy17
Coding God
Coding God
Posts: 1610
Joined: Mon Sep 07, 2009 12:25 am

Re: Send PictureBox and Chat
GoodGuy17
I've never dealt with TCP or used either of those Encoding.ASCII things.

3. When the two connected users chat, I want their usernames displayed.

Also, any idea how to show a list of usernames from other people trying to connect with you?
User avatar
muttley1968
Hardcore Programmer
Hardcore Programmer
Posts: 622
Joined: Thu Jun 17, 2010 11:54 pm

Re: Send PictureBox and Chat
muttley1968
well i dont know how to code tcp but from what dread said couldnt you make a label somewere with their username they can set and then just make it boradcast that before textbox and then the textbox if you get me
User avatar
MrAksel
C# Coder
C# Coder
Posts: 1758
Joined: Fri Mar 26, 2010 12:27 pm

Re: Send PictureBox and Chat
MrAksel
DreadNought wrote:
You can transform pictures into bytes which you can send over a TCP Connection and then transform it back to a picture.

You can transmit text into bytes and send it over a TCP Connection and then transform it to text.

Both use the Encoding.ASCII.GetBytes & Encoding.ASCII.GetString methods.

3. Hm?
You can't use ASCII encoding to get the bytes from an image..

Im sorry I dont have time to comment the code in the example now, but I can do it later if you need help :)
You do not have the required permissions to view the files attached to this post.
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;


Over 30 projects with source code!
Please give reputation to helpful members!

Image
Image
GoodGuy17
Coding God
Coding God
Posts: 1610
Joined: Mon Sep 07, 2009 12:25 am

Re: Send PictureBox and Chat
GoodGuy17
Im sorry I dont have time to comment the code in the example now, but I can do it later if you need help :)[/quote]
I honestly don't understand anything you did there...

Wait, actually, here is what I am trying to replicate:
GuessMyDraw.NET.rar
I'm trying to make one of those.
You do not have the required permissions to view the files attached to this post.
User avatar
MrAksel
C# Coder
C# Coder
Posts: 1758
Joined: Fri Mar 26, 2010 12:27 pm

Re: Send PictureBox and Chat
MrAksel
My program is sending image from a file the user selects to a picturebox on the server-side. If you didnt figure out how to use it; start the program and press 'Start listening'. It will tell you a port number.
Now, in the other form, replace the number after the colon in the textbox (90909) with the port number.
Click connect.
Press 'Send image' (idk what I called it) and select an image to send. It will show in the other form.
This method does not use
Code: Select all
Form2.PictureBox1.Image = Image.FromFile(file)
It sends the image over a TCP connection (what your webbrowser uses) to the server. This could be modified to be sent to other users of your application too, but opening ports might be needed unless you have a server that can run on its own port (on your computer, not the user's).
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;


Over 30 projects with source code!
Please give reputation to helpful members!

Image
Image
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: Send PictureBox and Chat
mandai
How do I send the Image inside of a PictureBox to someone using my program, and to their PictureBox?
A while back I made an example TCP image transfer server/client, you can find this here: viewtopic.php?t=8205&p=60699#p60699
How can I transmit text between me and another user?
You could design or use a protocol that allows this feature.
8 posts Page 1 of 1
Return to “Coding Help & Support”