|
When you create strings special characters require an escape sequence. Any unicode character can be escaped by using \u and the unicode value, \uFEFF is one I am using because of some pdf issue. Newlines are \n tabs are \t a \ is \\.
File Not Found
|
|
|
|
|
Good evening everyone,
I have a feeling it's a silly question but how can you transfer a variable from one object to another without having to create another instance of these objects.. say I have two open forms and I want to pass a value entered in one form to the other one.
Thanks a million
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
If you decalre a member as public static , you don't need an instance to access it.
As an example, if you declared a string in class like this:
public sealed class MyGlobal
{
public static string MyString = null;
}
You could access it from anywhare in your project like this:
MyGlobal.MyString = "hello";
MessageBox.Show( MainForm.MyString );
Hope this helps.
Regards
Wayne Phipps
____________
Time is the greatest teacher... unfortunately, it kills all of its students
View my Blog
|
|
|
|
|
IT WORKS!! Thanks a million Wayne
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
If the variable is a reference type, you won't be creating a new instance, you will simply be passing a reference to the existing object. If the variable is a value type, you can pass it as a reference:
...
int someVarIWantToPass = 0;
form2.PassVarByRef(ref someVarIWantToPass);
...
-- modified at 18:47 Tuesday 20th March, 2007
|
|
|
|
|
Thank you Edmundisme
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
I found a bit of code that allows you to add a webproxy to an HttpChannel
(http://dotnetjunkies.com/WebLog/chris.taylor/archive/2004/01/24/6050.aspx)
but even this approach would not work for TcpChannel. Is there some other way to implement a proxy functionality on a tcp channel?
|
|
|
|
|
Well, maybe you should look at custom sinks ... just an idea .. I'm not sure at all here
|
|
|
|
|
I've used sinks, but to my knowledge the last sink on the client side is the Transport Sink, and that cannot be customized or overridden.
|
|
|
|
|
Does anyone know how to concat on the displaymember of a combobox? I am trying to contatenate two fields together. Here is my code.
cboLocation.DataSource = ds;
cboLocation.DisplayMember = (string.Concat("Locations.LocationName", ' ', "Locations.LocationNo"));
cboLocation.ValueMember = "Locations.LocationNo";
When I did this, only the Locations.LocationNo shows. Need help.
|
|
|
|
|
what is your data source , if you are executing a query against a db , simply change your query to select Locations.LocationNo , (Location.LocationName + ' ' + Location.LocationNo) as LocationName from Locations
Taimur Khan
|
|
|
|
|
|
Thank you very much for reading and helping me.
I am now working with my degree final year project. I want to use a progress bar with style set to marquee to show a progress. However, I found that the progress bar does not scroll while I am running my project.
I have tested in a new project with only putting a progress bar with style marquee. It works smoothly. On the other hand, even if I new a form in my working project (the FYP one), and just putting a progress bar on it, it still cannot work. I also found that the appearance of the progress bar is flatten just like a disabled textbox.
May I know is there anything I have set it wrong?
I am new with C#. Thanks a lot for guiding me!
|
|
|
|
|
Post some sample of how you're trying to do it.
|
|
|
|
|
Thank you Zoltan. I guess that I did not include EnableVisualStyles() before newing the form.
I tried this and the progress bar did run.
I wonder why it does not need to enable visual style if I put a progess bar with marquee as style in a brand new project.
|
|
|
|
|
Because, by default, EnableVisualStyles is already turned on. Start a new Windows Forms project, then open the Program.cs file and you'll find it.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thank you very much Dave~!
Seems that I have asked a stupid question.
|
|
|
|
|
I want 2 change a particular color in gif image...... for example want to change the hair color according to user choice how I do dat Can any buddy give any idea......set pixel is very sklow anything else..........
|
|
|
|
|
I've been trying to implement the code found here, and everything works like a charm as long as all the machines I'm checking are up, but the thing freezes if one or more of them is down. I ran through with the debugger, and it freezes while executing the line I marked in the code below:
<br />
.<br />
.<br />
.<br />
try<br />
{<br />
start = Environment.TickCount;<br />
<br />
byteCount = socket.SendTo(sendBuffer, IcmpPacket.ICMP_PACKET_SIZE, SocketFlags.None, server);<br />
<br />
if (byteCount == SOCKET_ERROR)<br />
{<br />
result = PingResponseType.ConnectionError;<br />
response.ResponseTimes[i] = Constants.InvalidInt;<br />
}<br />
else<br />
<br />
byteCount = socket.ReceiveFrom(receiveBuffer, 256, SocketFlags.None, ref client); <br />
<br />
stop = System.Environment.TickCount;<br />
.<br />
.<br />
.<br />
in Ping.cs.
Again, this problem occurs only when a machine is offline (I've been unplugging one of them from the network to test it). I don't get an error or timeout, like I should. The program simply freezes.
I know this error is pretty darn specific, but hopefully someone out there has had some experience with it. I'm willing to provide any other pertinent details as necessary.
Thanks,
Sean
|
|
|
|
|
i have a string for example "i have a book".
i need to split it into many pieces and save it as an array string in condition that if a space found in the string split and save....
please help
thanks allot
|
|
|
|
|
string text = "i have a book";
string[] pieces = text.Split(' ');
|
|
|
|
|
thanks allot...
|
|
|
|
|
Hi,
I have a simple dialog box containing a ProgressBar and a label. I need to show progress for a lengthy operation with both a bar and some text.
I created a public method that takes care of incrementing the progress value, and setting the text for the label. When I run it though the bar shows the progress, but the label is all messed up (it doesn't update, and the dialog is all messed up where the label should be.)
I also tried setting the dialog's Text inside that method, but it's worse: after a few iterations the bar stops updating.
Has anyone seen this behavior? Is there anythign I can do?
thanx
|
|
|
|
|
Can you post a code sample here?
Are you trying to use another threads too?
|
|
|
|
|
No, it's all on the same thread.
The code is something like this:
MyProgressDlg progress = new MyProgressDlg();
progress.Maximum = 1000;
progress.Text = "Adding Products...";
progress.Show();
for(int i=0;...blahblahblah)
{
progress.ShowProgress("Processing" + i);
}
progress.Close();
in MyProgressDlg
public void ShowProgress(string text)
{
label1.Text = text;
progressBar1.Value++;
}
thanx
|
|
|
|