|
Hej bwood2020
You Migth whant to use a static resource that can laungh that form1 passes an event to
static class EventHandler
{
static Action Event;
public static void SetGlobalEvent(Action a)
{
Event = a;
}
public static void Execute_Event()
{
Event();
}
}
class Form1
{
public Form1()
{
EventHandler.SetGlobalEvent(Event);
}
public void Event()
{
var x = 2 + 2;
}
}
class Form2
{
public void Onclick()
{
EventHandler.Execute_Event();
this.Destroy();
}
}
There migth be a bether way of doing this if form1 creates form2 you can pass
in "this" from form1 as a parameter that way form2 whill be able to call the method on that object
Hopes this helps Patrik
|
|
|
|
|
Patrik.karlin wrote: if form1 creates form2 you can pass
in "this" from form1 as a parameter
... but now you're starting to couple unrelated classes - not a great idea. The easiest, sure - but best avoided.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
DaveyM69 wrote: ... but now you're starting to couple unrelated classes - not a great idea. The easiest, sure - but best avoided.
.... Yea Sure .. maybe the logic should be in the model....
form1 can subscribe to a datachanged event and form2 youst update's the
data in the model...
then they whill be completle seperated.
|
|
|
|
|
Does this look at all familiar? clickety[^]
[Edit]
Sorry wrong link! Try this one. here[^]
[/Edit]
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi Henry,
It does and I tried to aply the same logic but it wasn't working. The code I used to get this to work was differnt. I think it had to do with adding another event handler to take care of it.
|
|
|
|
|
|
You're looking for the ASP.NET forum. What you asked has nothing to do with C#.
|
|
|
|
|
Dave Kreskowiak wrote: You're looking for the ASP.NET forum
Ftfy, Web Development
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Please, help.... or suggest approach; this is a second posting.
I'm sure that there have been a thousand questions on this topic, but here goes...
I have an application that uses the System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces() to retreive each friendly interface name on a machine with multiple adapters. Later, depending on other choices, the application needs to start UDP multicasting. For this I need to be able to find the IP address of the interface chosen. As I said, all I have is the friendly adpter name. How can retreive the IP address(es) of the NIC starting only the adapter name?
Raven
|
|
|
|
|
Get all interfaces again and search for the one with the right name?
|
|
|
|
|
The call that provices the adapter names has no option to produce the IP addresses assigned to the interface... therein lies the problem--how to find the IP addresses associated with the network interface
|
|
|
|
|
IIRC they are in the same order as returned by Dns.GetHostAddresses
That worked for me, anyway.
would the person who 1-voted me care to explain why? Did I remember incorrectly? (couldn't you just have told me so?) Last modified: 18mins after originally posted --
|
|
|
|
|
It lokos like you got hit by a Drive-By Univoter...
|
|
|
|
|
Yes it would seem so.. he didn't drive around the rest of the forum too much though lol
|
|
|
|
|
When you call GetAllNetworkInterfaces , each instance of the NetworkInterface object you get back has a GetIpProperties method. Call that method on each interface and you'll get an IpInterfaceProperties object with all the IP address details in it for that adapter.
modified on Thursday, July 9, 2009 4:29 PM
|
|
|
|
|
That would be better than my less-than-reliable approach.
|
|
|
|
|
Hi Harold,
I'm not the one that onevoted you, however since I liked your latest message much more than the previous one, here is a 5.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
I'm writing a Windows Mobile 6 application in C#.NET. how can i search for wifi connections nearby and get ip
This code was posted by me...
|
|
|
|
|
|
1 want to list all wi-fi network connections using C#.
This code was posted by me...
|
|
|
|
|
Try a google search.[^]
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
I love it, I thought I'll take a look at the results for this one. 1st link is to CP, straight back to this message
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Yeah,it's intersing result search
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
Blue_Boy wrote: intersing result search
Latest page update phenomenon is the reason that is causing Google to bring this page on top.
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep!
|
|
|
|
|
Hallo Board,
I am facing a problem with a self-written Equal Operator on a list<> class with own classes inside the list.
I want to compare lists thus I redefined the == Operator:
public override bool Equals(object obj)<br />
{<br />
UserList compUserList = (UserList)obj;<br />
foreach (PersonDataSet user in compUserList.list)<br />
{<br />
....
return true;<br />
}<br />
return false;<br />
}<br />
The problem is now that I checked in my code before writing the own operator if a special UserList has already been created by
if (testUserList != null) .
Now I get a NullPointer exception wenn testing for 'null'.
This is understandable, but does anyone have an idea how to solve the problem? Maybe a different check to test if an object has been created? Or is a check like this not good at all?
Thanks for your replies!
Regards
Chris
modified on Monday, July 13, 2009 5:32 AM
|
|
|
|