|
I would love to do it this way, but that defeats the purpose of the problem, which is to illustrate how to do it with an array. I need to learn C#, and this book has been very useful, but it really does not explain how to do this part, at all.
|
|
|
|
|
let us consider we have two forms form1 and form2 and there are some information in form1 that i would like to use in form2... which method should i use to perform this action?
|
|
|
|
|
if form1 create form2 then from form2 you can define a public var. like this:
int x;
public int X
{
set
{
x=value;
}
}
then when you create you can send the var. like this:
form2 f2=new form2();
f2.X=5;
f2.show();
|
|
|
|
|
suppose we have a tab of buttons in form1 and i want to use the text of the clicked button in form2... how can i do such a thing?
|
|
|
|
|
use delegation:
in form1 create textbox and put:
public delegate void dd(string s);
public static dd d;
and put (d=new dd(write);) in public Form1()
then write method (write):
privet void write(string s)
{
textbox1.text=s;
}
in form2 create button and textbox then in click event put:
Form1.d(textbox1);
modified on Wednesday, January 20, 2010 6:53 PM
|
|
|
|
|
There are three obvious ways if Form1 is the parent.
1. Form1 sets a property in Form2 (as suggested above)
2. Form1 calls a method in Form2
3. Form2 raises a custom DataRequest event with custom EventArgs . Form1 subscribes to this and fills the event args accordingly when it handles the event.
If Form2 is the parent form then a DataChanged event in Form1 and a suitable handler in Form2 is the way to go.
If the hierachy is different, then a combination of the above up and down the hierachy will work. If that gets too complex then a separate manager class that routes events between the class instances can be useful.
Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Hi
I need to validate the email addresses to check if they are existing or not.
I used the following code to check first for the validation of domain but it failed with the following exception : A connection attempt failed because the connected party did not properly respond after a certain period of time, or established connection failed because conencted host has failed to respond 209.85.135.17:25
Here I used 25 port but is that port valid or i have to use someother port.
string address = "test@g.com";
string[] host = (address.Split('@'));
string hostname = host[1];
IPHostEntry IPhst = Dns.Resolve(hostname);
IPEndPoint endPt = new IPEndPoint(IPhst.AddressList[0], 25);
Socket s= new Socket(endPt.AddressFamily,
SocketType.Stream,ProtocolType.Tcp);
s.Connect(endPt);
Can anyone please help me. Any Ideas please!! I need it urgently.
Thanks in advance,
--
http://ashakthi.blogspot.com
http://kids-articles.blogspot.com
|
|
|
|
|
In my country many providers block port 25 to reduce spam. tried another?
|
|
|
|
|
This will also depend on the firewall settings on your network setting etc.
Now...bring me that horizon. And really bad eggs...Drink up me hearties, YO HO!
|
|
|
|
|
|
Hi men and womens
I want to reading email message by C#
and as you know the c# dont apply the pop3 protocol
so I used The Tcp class to connect and reading message from the server
But the problem is when I try to read the message ,it read all the content of the message
as Message Id and some html tages
so
How can I read The Body Or Subject only
because I want to use form to Show From ,To,Subject,Body only so how
and thanks so so so so so much
|
|
|
|
|
Such email message is a file containing:
- a header
- a blank line
- the body (in ascii, can be empty)
- followed with 0 or more attachments
Rfc 822 descibes this and http://www.ietf.org/rfc/rfc2045.txt?number=2045[^] descibes the attachments (also read 2046,2047,2048)
Because many people use an email-client that produces a html-version of the body, these messages will have an ASCII-version in the body and the html-version as an (hidden) attachment. Sometimes the body is empty and there's only an attachment.
Hope this answers your question.
|
|
|
|
|
My apologies if something like this has already been asked and answered; I did some Google searching, as well searching on this site, and didn't find it, so here goes. I'm new to the world of .NET 3.5 and Linq. What I have are 1 + n xml files. The first Xml file looks sort of like this:
<files>
<file id="1" name="(some guid)"/>
<file id="2" name="(some guid)"/>
</files>
There are then files in the same directory, whose name matches the guid plus .xml, like so:
<file id="1">
<prop1>Value 1</prop1>
<prop1>Value 1</prop1>
<prop1>Value 1</prop1>
</file>
What I'd like to be able to do is this: for each file listed in the first xml blob, I want to create an object based on the values in each of the other xml files that look like the 2nd blob, and return that as an IEnumerable<Thing>. Does anybody know where I can find an example of how to do this?
Thanks in advance.
|
|
|
|
|
Greetings
I want to build a windows application that can connect to a webserver to get user authentication. Just like any IM msngr. We install the windows application and later it connects to internet to get authentication. How can I make such application???
Plz help.
modified on Wednesday, January 20, 2010 2:06 PM
|
|
|
|
|
Can anyone tell me why when writing code to open a file you use a forward slash in the path name instead of a back slash as in the following:
private void button1_Click(object sender, EventArgs e)
{
string file_name = "C:/test1.txt";
System.IO.StreamReader objReader;
objReader = new System.IO.StreamReader(file_name);
textBox1.Text = objReader.ReadToEnd();
objReader.Close();
}
|
|
|
|
|
Because it's easy to type!
In this case the slash ("/") and backslash ("\") are both understood as the delimiter for path, so either one should work. However, backslash is used to escape in string literals, so to use backslash, you should escape it, like so: \\. You can see that is more typing than using just slash.
If you have a lot of backslashes in your string literal, you can put @ in front of it so you don't need to escape them. For example,
string file_name = @"C:\test1.txt";
Still, there is the character @ you have to type. It's still more typing than simply using the forward slash.
|
|
|
|
|
Thanks
|
|
|
|
|
My guess is that it's simply a cheat to avoid having to type the requisite double backslash (special character):
string file_name = "C:\\test1.txt";
...Byte conservation; it's one byte shorter in the source file.
|
|
|
|
|
Thanks That's the problem with using tutorials...nobody around to answer the howcomes.
|
|
|
|
|
Darrall wrote: string file_name = "C:/test1.txt";
Because it works . It transforms into "C:\\test1.txt";
But I don't. I use either
@"C:\test1.txt";
"C:\\test1.txt";
|
|
|
|
|
Thanks
|
|
|
|
|
Reading this article might give you some more information.
Now...bring me that horizon. And really bad eggs...Drink up me hearties, YO HO!
|
|
|
|
|
|
Hi all
In my program i want to get image from users and insert it into mydatabase .
Now i want to know how can i insert image into database?
Thx alot for your attention.
|
|
|
|
|
You can conduct a search on "blob and database". An image can be treated as a blob (binary large object). Database tables can have blob fields. They can be used to hold images.
|
|
|
|
|
Thx for your reply.
I can't understand your answer.
I want to insert an image to sql server database.
How can i do it?
|
|
|
|
|