|
Only a short question,
is there a chance to splitting a string into substrings and chars?
I have no idea how to make this. To split a string in substrings it's clear to me, also to make a string to chars... but how could i split substrings and chars from one string?
If you want realize your dreams, you shouldn't sleep!
|
|
|
|
|
Hi All,
I am writing a code to transmit data from a client to a server using sockets. The first data transmitted from the client to the server gets transmitted, after that I get a error when I attempt to send a 2nd set of data. It says "Operation not allowed on non-connected sockets". Part of my code is
Client Code:
private void TcpDataSendTransmitter()
{
/*This is line which is giving me the error*/
networkStream = tcpClientListner.GetStream();
streamWriter = new System.IO.StreamWriter(networkStream);
streamReader = new System.IO.StreamReader(networkStream);
try
{
string temp = txtData.Text;
streamWriter.WriteLine(temp);
streamWriter.Flush();
listBoxClient.Items.Add(temp);
}
.
.
.
}
Server code:
if(clientSocketListener.Connected)
{
NetworkStream networkStream = new NetworkStream(clientSocketListener);
System.IO.StreamWriter streamWriter = new System.IO.StreamWriter (networkStream);
System.IO.StreamReader streamReader = new System.IO.StreamReader(networkStream);
streamWriter.WriteLine("Server: Your Are Connected");
streamWriter.Flush();
temp = streamReader.ReadLine().ToString();
listBoxServer.Items.Add(temp);
}
What could be the possible Solution for this.
Regards
Tarakeshwar
|
|
|
|
|
Judging by the exception message, your client or server has disconnected. Look through your code and 1) make sure your code is tolerant in such cases, since this is something you really can't control (either one could loose their connection at any time, and 2) that you are closing your connection prematurely. I see nothing of the sort in your sample code, but it could easily exist elsewhere in your code.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Yeah I went through the Code, I think the problem is in my server Code. I have been trying to debug it. The problem is I have initialised the connection in the Connect Button. So only for the first instance when I connect using the button the connection exist. After that the server is not in the listening mode as the event is in the connect button. I will have to initialise my tcp Connection and the thread outside the button click event. That should hopefully solve the problem.
Tarakeshwar
MCSE(Security), CCIE Q(Routing and Switching)
|
|
|
|
|
If your TCP socket connection variable (TcpListener or whatever you're using) is declared in the event handler, then it will be garbage collected when it goes out of scope (and when the GC gets around to it). You need to at least declare it outside of your event handler, just like buttons, text boxes, and other UI components are declared as fields and initialized in a method.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
did a program that lists stats for creatures that will combat each other. Need some help to clone this object for the users desired number of fighters and then each winner will combat the other winner until there is one winner.
i am new to this stuff. hope i am not asking to much or even if it is bad manners or anything.
|
|
|
|
|
If you're new to .NET development, why don't you start creating simple applications and reading the vast number of articles on .NET development (with C#, VB.NET, and other languages) on sites like CodeProject?
If you want to write an application, this is not the place for help to write an entire application. This forum - and pretty much any other forum you'll ever find - are for specific problems or questions, not to help you write an application from scratch. That requires actually knowing something about programming, and only you can discover that.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I agree with what you said, but I sometimes think that OOP would be a good topic for a discussion board. Did anyone ever suggest that?
Regards,
Jeff Varszegi
|
|
|
|
|
Hi
I developed a new open-source filebrowser with c# that i want to share with you.
You can download it here:
www.slender.be
The application runs very nice but contains also some errors. When you are searching for a file. Sometimes i got a thread error. And the progressbar in the move/copy dialog doesn't work very good.
I hope you can help me developing this application.
(if you don't want helping me, you can always try to use it.)
Jonathan Slenders
Jonathan Slenders
|
|
|
|
|
did a program that lists stats for creatures that will combat each other. Need some help to clone this object for the users desired number of fighters and then each winner will combat the other winner until there is one winner.
i am new to this stuff. hope i am not asking to much or even if it is bad manners or anything.
|
|
|
|
|
hello,
I'm using an Xml-file to fill my dataset and i place the dataset in my datagrid. My problem is that when i click a row in the datagrid, i want the data in text and/or checkboxes that are placed below the datagrid. Is this possible?
thx in advance!
|
|
|
|
|
In a handler, you can get the CurrentRowIndex of your datagrid. You can use this to get values from your cells. You shouldn't have much trouble putting them into your other boxes below the grid.
something like
textBox1.Text = dataGrid1[dataGrid1.CurrentRowIndex,0].ToString();
You'll have to play around with it a little. Good luck
|
|
|
|
|
Hi Appelz,
Following code will get you the text in the DataGrid cell where mouse is being clicked.
Paste the following code in MouseUp event of the DataGrid Control.
private void DataGrid1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)<br />
{<br />
System.Drawing.Point pt = new Point(e.X, e.Y); <br />
DataGrid.HitTestInfo hti = DataGrid1.HitTest(pt); <br />
<br />
if(hti.Type == DataGrid.HitTestType.Cell) <br />
{ <br />
string str = "";<br />
str = DataGrid1[hti.Row, hti.Column].ToString();<br />
MessageBox.Show(str);<br />
} <br />
<br />
}
Do revert back, whether you could achieve the functionality or not.
Regards,
Jay.
|
|
|
|
|
yes thank you it works well
But i put what is in the messagebox, in a textbox so it can be edited.
Now i added a button and if you click on it i want the data added in the textbox back into the grid (in the right cell).
is this possible or too difficult because i can't make it work?
|
|
|
|
|
Hi Appelz,
try the code below
DataGrid1[hti.Row, hti.Column]=textBox1.Text;<br />
DataGrid1.Invalidate();
Regards,
Jay
|
|
|
|
|
Hello there
I have a Winform whit a birth date field that I enter
I want to get Pup up Form Whit a 1 week reminder off all my birth date of all my customers & I want an also 3 day remind & at the same date
Exsmpale : if i enter that Tomi birthdate is in 15/08/1974
i want pupup that remind me in 10/08/2004 in 13/08/2004 in
15/08/2004
how can I do it ?
I am working whit a Accses Database & C#
thanks allot to all...
please help...
|
|
|
|
|
Hi!!!
Some body know how to write some algoritm to compress text strings???
Greetings
S_W
|
|
|
|
|
Hi,
I'm looking for an event / function that gets called when your assembly gets loaded.
The problem now is that I declare a static member variable in a class which only gets initialised when the class is explicitly used. This variable however has to be initialised for every class which is used in the assembly, but without having to go through the trouble of putting code in every class' constructor.
The reason why this variable has to be initialised when the assembly gets loaded and before any class is constructed is because this variable init checks whether the user has a valid license to use this assembly.
Thanks very much in advance,
Arthur van der Wal
|
|
|
|
|
Hello,
I am wondering if you ever found an answer to this question? I wish to do the same thing.
Tanks for your support
Pat O
<a href="http://currentchaos.blogspot.com/">Blog</a>
_ _ _
|
|
|
|
|
Hi, I have created a windows application which shows a system tray icon and some menu on it. When i run it by doubl click it runs perfect icon is visible in system tray. I put that exe path in registry "HKEY_LOCAL_MACHINE\Microsoft\Windows\CurrentVersion\Run". So when user login to the system my application starts running in the background but it doesnt show icon in the system tray.
Urgent reply required.
Thanks
|
|
|
|
|
hai there,
if i am debuging my widows or console application. Then i can notice the current values of variables that i am using in my application. my question is how can i view the values of
ArrayList, Hash Table or any Sorted List.
Appart from this view the Flow of Execution ?
hai, feel free to contact
Sreejith SS Nair
|
|
|
|
|
Look down in the "autos" section. Look at the variable naming one of your data structure variables. It should have a little expandable plus sign-- click on that and you will see the values it contains.
Regards,
Jeff Varszegi
|
|
|
|
|
Word of warning to the original poster, though - this doesn't work very well at all for Hashtable s. You have to dig deep to find any relevant data.
In VS.NET 2005, they are adding new debug views, such as extensible tooltips and data viewers to solve problems such as this. DataSet s are also difficult to debug so they would have a view associated with them that lets you view (and modify) the XML data in a text box or view it using MSXML hosted in Internet Explorer, as well as a generic DataGrid (last time I checked).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Word of warning to the original poster, though - this doesn't work very well at all for Hashtables. You have to dig deep to find any relevant data.
I'm using VS.NET 2003, and it works-- although it's a little confusing. The top "twistie" expands to show all the entries (haven't tried it on large numbers of entries), and then each one of those expands to show the details of the data element of the mapping. I seem to remember once trying to peer into a Hashtable during debugging on 2002 and having the IDE hang, but at least that's not happening now.
Regards,
Jeff Varszegi
|
|
|
|
|
I know it works, but the important part was "well". Perhaps I mis-phrased, but that's basically what I meant: that it was a little - as you put it - "confusing".
Microsoft MVP, Visual C#
My Articles
|
|
|
|