Click here to Skip to main content
11,701,855 members (69,462 online)
   

C#

 
QuestionImporting Images onto Design Stage Pin
ASPnoob23-Jan-13 18:03
memberASPnoob23-Jan-13 18:03 
AnswerRe: Importing Images onto Design Stage Pin
Eddy Vluggen24-Jan-13 0:40
mvpEddy Vluggen24-Jan-13 0:40 
Questionstring[] to Microsoft.Exchange.Data.MultiValuedProperty Pin
JD8623-Jan-13 12:22
memberJD8623-Jan-13 12:22 
AnswerRe: string[] to Microsoft.Exchange.Data.MultiValuedProperty Pin
jibesh23-Jan-13 13:28
memberjibesh23-Jan-13 13:28 
GeneralRe: string[] to Microsoft.Exchange.Data.MultiValuedProperty Pin
JD8625-Jan-13 3:41
memberJD8625-Jan-13 3:41 
QuestionI need help with my drag and drop code Pin
cdaviesp23-Jan-13 10:24
membercdaviesp23-Jan-13 10:24 
AnswerRe: I need help with my drag and drop code Pin
pt140125-Jan-13 9:19
memberpt140125-Jan-13 9:19 
Questionnested try catch block Pin
000mann00023-Jan-13 6:59
member000mann00023-Jan-13 6:59 
GeneralRe: nested try catch block Pin
PIEBALDconsult23-Jan-13 7:06
memberPIEBALDconsult23-Jan-13 7:06 
GeneralRe: nested try catch block Pin
000mann00023-Jan-13 7:11
member000mann00023-Jan-13 7:11 
GeneralRe: nested try catch block Pin
PIEBALDconsult23-Jan-13 7:12
memberPIEBALDconsult23-Jan-13 7:12 
AnswerRe: nested try catch block Pin
Paulo Zemek23-Jan-13 7:23
memberPaulo Zemek23-Jan-13 7:23 
GeneralRe: nested try catch block Pin
000mann00023-Jan-13 7:25
member000mann00023-Jan-13 7:25 
QuestionClient is not connecting to the server Pin
Skytten23-Jan-13 5:33
memberSkytten23-Jan-13 5:33 
Hey folks!! Hope you can help me with my client code.
Först I debugg the Server wich is an consoleapplication and the server starts, secondly I debugg the Client, I put a nickname value to the nickNameTextBox and click on Connect (button2) the compiler stops at this code line
serverStream.Write(outStream, 0, outStream.Length);
It says that the objectreference has not given an instans of a object!!

Note!!!! The code is working fine with VS 2008 but Im currently trying to work with it on VS 2010 but it wont run like it should

This is the Client
using System.Windows.Forms;
using System.Net.Sockets;
using System.Threading;
 
namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        System.Net.Sockets.TcpClient clientSocket = new System.Net.Sockets.TcpClient();
        NetworkStream serverStream = default(NetworkStream);
        string readData = null;
 
         public Form1()
        {
            InitializeComponent();
            
        }
      
        //Connect to the Server
         private void button2_Click(object sender, EventArgs e)
         {
         //    clientSocket.Connect("127.0.0.1", 8888);
         //    serverStream = clientSocket.GetStream();

 
             byte[] outStream = System.Text.Encoding.ASCII.GetBytes(nickNameTextBox.Text + "$");
             serverStream.Write(outStream, 0, outStream.Length);
             serverStream.Flush();
 
         }
 
         private void button1_Click(object sender, EventArgs e)
         {
            
             readData = "Conected to Chat Server ...";
             msg();
             clientSocket.Connect("127.0.0.1", 8888);
             serverStream = clientSocket.GetStream();
 
             byte[] outStream = System.Text.Encoding.ASCII.GetBytes(sendTextBox.Text + "$");
             serverStream.Write(outStream, 0, outStream.Length);
             serverStream.Flush();
 
             Thread ctThread = new Thread(getMessage);
             ctThread.Start();
 
         }
         private void getMessage()
        {
            while (true)
            {
                serverStream = clientSocket.GetStream();
                int buffSize = 0;
                byte[] inStream = new byte[10025];
                buffSize = clientSocket.ReceiveBufferSize;
                serverStream.Read(inStream, 0, buffSize);
                string returndata = System.Text.Encoding.ASCII.GetString(inStream);
                readData = "" + returndata;
                msg();
            }
        }
 
        private void msg()
        {
            if (this.InvokeRequired)
                this.Invoke(new MethodInvoker(msg));
            else
                loggTextBox.Text = loggTextBox.Text + Environment.NewLine + " >> " + readData;
        }

AnswerRe: Client is not connecting to the server Pin
OriginalGriff23-Jan-13 5:41
mvpOriginalGriff23-Jan-13 5:41 
GeneralRe: Client is not connecting to the server Pin
Skytten23-Jan-13 5:55
memberSkytten23-Jan-13 5:55 
GeneralRe: Client is not connecting to the server Pin
OriginalGriff23-Jan-13 6:07
mvpOriginalGriff23-Jan-13 6:07 
GeneralRe: Client is not connecting to the server Pin
Skytten23-Jan-13 6:09
memberSkytten23-Jan-13 6:09 
GeneralRe: Client is not connecting to the server Pin
OriginalGriff23-Jan-13 6:20
mvpOriginalGriff23-Jan-13 6:20 
GeneralRe: Client is not connecting to the server Pin
Skytten23-Jan-13 6:26
memberSkytten23-Jan-13 6:26 
GeneralRe: Client is not connecting to the server Pin
OriginalGriff23-Jan-13 8:04
mvpOriginalGriff23-Jan-13 8:04 
GeneralRe: Client is not connecting to the server Pin
Skytten23-Jan-13 10:03
memberSkytten23-Jan-13 10:03 
GeneralRe: Client is not connecting to the server Pin
OriginalGriff24-Jan-13 0:04
mvpOriginalGriff24-Jan-13 0:04 
GeneralRe: Client is not connecting to the server Pin
Skytten24-Jan-13 12:57
memberSkytten24-Jan-13 12:57 
QuestionC# parameters Pin
classy_dog23-Jan-13 4:37
memberclassy_dog23-Jan-13 4:37 
AnswerRe: C# parameters Pin
Richard MacCutchan23-Jan-13 5:04
mvpRichard MacCutchan23-Jan-13 5:04 
GeneralRe: C# parameters Pin
PIEBALDconsult23-Jan-13 5:29
memberPIEBALDconsult23-Jan-13 5:29 
AnswerRe: C# parameters Pin
jschell23-Jan-13 8:59
memberjschell23-Jan-13 8:59 
AnswerRe: C# parameters Pin
BC @ CV23-Jan-13 10:17
memberBC @ CV23-Jan-13 10:17 
QuestionC# file Pin
classy_dog23-Jan-13 4:31
memberclassy_dog23-Jan-13 4:31 
AnswerRe: C# file Pin
deflinek23-Jan-13 4:37
memberdeflinek23-Jan-13 4:37 
GeneralRe: C# file Pin
PIEBALDconsult23-Jan-13 5:10
memberPIEBALDconsult23-Jan-13 5:10 
GeneralRe: C# file Pin
OriginalGriff23-Jan-13 5:36
mvpOriginalGriff23-Jan-13 5:36 
QuestionUse axFrameControl to open the ppt encountered the error Pin
Jason Fang_22-Jan-13 21:55
memberJason Fang_22-Jan-13 21:55 
AnswerRe: Use axFrameControl to open the ppt encountered the error Pin
micke.andersson28-Jan-13 2:55
membermicke.andersson28-Jan-13 2:55 
QuestionCreating Various Files Using C# Pin
ASPnoob22-Jan-13 17:28
memberASPnoob22-Jan-13 17:28 
AnswerRe: Creating Various Files Using C# Pin
PIEBALDconsult22-Jan-13 18:14
memberPIEBALDconsult22-Jan-13 18:14 
AnswerRe: Creating Various Files Using C# Pin
Abhinav S22-Jan-13 19:35
mvpAbhinav S22-Jan-13 19:35 
AnswerRe: Creating Various Files Using C# Pin
Rahul Rajat Singh22-Jan-13 19:38
mvpRahul Rajat Singh22-Jan-13 19:38 
AnswerRe: Creating Various Files Using C# Pin
OriginalGriff22-Jan-13 21:33
mvpOriginalGriff22-Jan-13 21:33 
QuestionC# update a audit table Pin
dcof22-Jan-13 15:56
memberdcof22-Jan-13 15:56 
AnswerRe: C# update a audit table Pin
Mycroft Holmes22-Jan-13 16:28
memberMycroft Holmes22-Jan-13 16:28 
AnswerRe: C# update a audit table Pin
PIEBALDconsult22-Jan-13 18:25
memberPIEBALDconsult22-Jan-13 18:25 
GeneralRe: C# update a audit table Pin
dcof23-Jan-13 4:41
memberdcof23-Jan-13 4:41 
GeneralRe: C# update a audit table Pin
PIEBALDconsult23-Jan-13 5:46
memberPIEBALDconsult23-Jan-13 5:46 
QuestionTwo others BindingNavigators in one form. How? Pin
Czajo22-Jan-13 6:26
memberCzajo22-Jan-13 6:26 
AnswerRe: Two others BindingNavigators in one form. How? Pin
Mycroft Holmes22-Jan-13 15:33
memberMycroft Holmes22-Jan-13 15:33 
GeneralRe: Two others BindingNavigators in one form. How? Pin
Czajo22-Jan-13 21:19
memberCzajo22-Jan-13 21:19 
QuestionRunning an exe Pin
TheGermoz22-Jan-13 5:50
memberTheGermoz22-Jan-13 5:50 
AnswerRe: Running an exe Pin
mark merrens22-Jan-13 6:07
membermark merrens22-Jan-13 6:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web04 | 2.8.150819.1 | Last Updated 27 Aug 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid