|
I need to invoke a methods using reflection. I don't know how to get the variable reference so I can invoke the methods with 'ref' parameter. Same problem with 'out'.
|
|
|
|
|
The parameteres you pass to the invoke method are put in an object[]. When you call a function with a ref or out parameter, the value will come back as part of that array.
|
|
|
|
|
Hey. I have a main form which uses a modal dialog box. When the user hits a button on the modal dialog I then proceed to close the modal dialog and return to the main form..
I am closing the modal dialog box from inside itself. OnbuttonClick();
ie ... OnButtonClick()
{
this.Close();
}
It gives me this!
An unhandled exception of type 'System.InvalidOperationException' occurred in system.windows.forms.dll
Additional information: Forms that are already displayed modally cannot be displayed as a modal dialog. Close the form before calling showDialog.
I have no clue why it isn't working.. If anyone could help it would be hugely appreciated. Thanks..
|
|
|
|
|
this.DialogResult = DialogResult.Cancel; is enough to do the trick.
|
|
|
|
|
Even when i do that is still throws an error...
What I am doing is I have my main form.. My main form calls .ShowDialog() of another form... and then that form calls .ShowDialog() again.
So i have a my main window which calls show and then the new window calls show
When i do: this.DialogResult = DialogResult.Cancel;
You can see it close the appropriate form but then it throws an error.
Please help.. Thanks...
|
|
|
|
|
Basically what I am doing is a touch screen application.. And each modal dialog of a form ie. .ShowDialog is an attempt to show a new screen to the user.. So I have my main form with some buttons and the user clicks a button.. This brings the user to a new screen or form. And when the user clicks another button on that form it brings him to another form.
What would be the best way to go about displaying these forms? They have to be forms.. Cause I am using the opacity of the forms to do fading from screen to screen.. But if the user wants to go back to a previous form. I need a way to close the form without some error like I am getting now.
If anyone could help.. It would be the hugest help..
Thanks so much.
|
|
|
|
|
Why is this modal at all ? If you need a sequence of forms with clickable buttons, you just need to show the forms. I recommend you replace all those .ShowDialog() calls with simple .Show() calls.
|
|
|
|
|
Thanks so much for sticken with me on this...
Okay the thing is the modal forms are mostly transparent in nature.. With only the buttons being visible. It's kinda weird but it's for a theme I am going with on this touchscreen. To do fading in and out and have the buttons at half opacity. If the form isn't modal and the transparent part of the form get's clicked the form will actually lose focus and the form below it will end up receiving the click event. This is not good.
I guess my example might be kinda complex.. I have a main form Form1. which then loads a graphics screen [Form2] which fades from the main screen to itself going from 0 to 100 opacity. Then the buttons on a transparent form[which are actually just pictureboxes set up to act like buttons] fade in over Form3 but only to 60% opacity.
See now if the user was now to use the touchscreen in this state and the user was to touch something that wasn't a button on Form3 [ie. the transparent area]. The event would not be caught by Form3 but by Form2.
Which means Form3 now lost it's focus.
I am going isane trying to figure this out. If you could help me I can't even explain how helpful that would be.
Thanks very much.
Steve
|
|
|
|
|
gekoscan wrote:
If the form isn't modal and the transparent part of the form get's clicked the form will actually lose focus and the form below it will end up receiving the click event
That's where I don't see why you don't handle the focus yourself with a non-modal Form. Even with a non-modal Form, you can subscribe to a lot of Form or simple control events and act accordingly.
The trouble with modal Forms is they have each a running ThreadContext attached to it, so you've got to either :
- let the modal Form workflow work as expected, (even if you add a few tweaks such as the DialogResult stuff)
- hack the ThreadContext to make sure internals are properly synchronized (so you don't end up with an exception).
- or simply catch those exceptions with a try{}catch(){} container (!)
All of this sounds ugly enough to me.
|
|
|
|
|
i want to send some messages programatically to all computers of the network using
some socket programming and a perticuler port say (999).
is it possible that i send this message using broadcaste ip like 192.168.0.255:999.
when i use this command on command prompt then it sends message on all computers of the network
------------------------
net send * some message
------------------------
in the above command what does * means?
what is the value of this ip address is?
r00d0034@yahoo.com
|
|
|
|
|
The best thing here IMO would be to use a multicast sender/reciever.
mcastSend.cs
using System;
using System.Net;
using System.Net.Sockets;
namespace multiCastSend
{
class send
{
send(string mcastGroup, string port, string ttl, string rep)
{
IPAddress ip;
try
{
Console.WriteLine("MCAST Send on Group: {0} Port: {1} TTL: {2}",mcastGroup,port,ttl);
ip=IPAddress.Parse(mcastGroup);
Socket s=new Socket(AddressFamily.InterNetwork,
SocketType.Dgram, ProtocolType.Udp);
s.SetSocketOption(SocketOptionLevel.IP,
SocketOptionName.AddMembership, new MulticastOption(ip));
s.SetSocketOption(SocketOptionLevel.IP,
SocketOptionName.MulticastTimeToLive, int.Parse(ttl));
byte[] b=new byte[10];
for(int x=0;x<b.Length;x++) b[x]=(byte)(x+65);
IPEndPoint ipep=new IPEndPoint(IPAddress.Parse(mcastGroup),int.Parse(port));
Console.WriteLine("Connecting...");
s.Connect(ipep);
for(int x=0;x<int.Parse(rep);x++)
{
Console.WriteLine("Sending ABCDEFGHIJ...");
s.Send(b,b.Length,SocketFlags.None);
}
Console.WriteLine("Closing Connection...");
s.Close();
}
catch(System.Exception e) { Console.Error.WriteLine(e.Message); }
}
static void Main(string[] args)
{
new send("224.5.6.7", "5000", "1", "2");
}
}
}
mcastRecv.cs
using System.Net.Sockets;
using System.Net;
using System;
namespace multiCastRecv
{
class recv
{
recv(string mcastGroup, string port)
{
Socket s=new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
IPEndPoint ipep=new IPEndPoint(IPAddress.Any,int.Parse(port));
s.Bind(ipep);
IPAddress ip=IPAddress.Parse(mcastGroup);
s.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(ip,IPAddress.Any));
while(true)
{
byte[] b=new byte[10];
Console.WriteLine("Waiting for data..");
s.Receive(b);
string str = System.Text.Encoding.ASCII.GetString(b,0,b.Length);
Console.WriteLine("RX: " + str.Trim());
}
}
public static void Main(string[] args)
{
new recv("224.5.6.7","5000");
}
}
}
WebBoxes - Yet another collapsable control, but it relies on a "graphics server" for dynamic pretty rounded corners, cool arrows and unlimited font support.
|
|
|
|
|
Hi all,
I am creating a custom user control (inherited from the UserControl class), and I would like to mimic the behaviour of the standard Button control.
When you set the Text property of the Button to '&Close', the button shows: 'Close'. When you press ALT+C when the form is active, the button will receive a click event.
Does anyone has an idea about how to accomplish this?
Greetz,
Jan
|
|
|
|
|
|
Thanx for your reply. But I want to have all the needed code in my new User Control, just like the standard button.
When you place a standard button on a form, and set the the text to '&Close', the click event will be called whenever the alt+c keys are pressed (and the form has focus). Even if the current focus is in a textbox on that form for example.
Any idea's??
Jan
|
|
|
|
|
|
(Thx again)
But can the form catch all the keypresses, even if the keypreview property is set to false??
Thanks for your time...
Jan
|
|
|
|
|
i want to get the ip address of all computers on a network
that have this broadcast address 255.255.255.0.
is there any method or tecnique available available to get that ?
if i have to send a message to all computers on a network through
a net send command what ip address i have to mentation ?
i have two computers that have these ip addresses 192.168.0.1
and second one is this 192.168.0.96.
because when i do this on command prompt this appears.
D:\Documents and Settings\super>net send 255.255.255.0 hell
An error occurred while sending a message to 255.255.255.0.
The message alias could not be found on the network.
More help is available by typing NET HELPMSG 2273.
D:\Documents and Settings\super>net helpmsg 2273
The message alias could not be found on the network.
EXPLANATION
This message alias could not be located.
ACTION
Check the spelling of the message alias. If it is correct, then the computer tha
t is to receive your message may be busy. Try sending the message again later.
r00d0034@yahoo.com
|
|
|
|
|
|
can u tell how to do it in a program ?plz tell simple code i will be very thank full?
r00d0034@yahoo.com
|
|
|
|
|
I was just wondering if someone could tell me why an imagelist has such small storage.. Isn't it bad to reference a just a .bmp from a peice of software.. How can i make it hidden if it won't fit in a Imagelist??
Thanks
|
|
|
|
|
Hi all,
I am developing this image edit application. I want to provide undo and redo of actions - rotate, scale and crop. Any suggestions on what will be the best way to implement this ? I am more interested on the undo implementation after a crop.
Keeping a backup image in memory can be one option. But when it comes to undo-ing multiple actions, it might become inefficient
Smitha
Whenever I see an old lady slip and fall on a wet sidewalk, my first instinct is to laugh. But then I think, what if I was an ant, and she fell on me. Then it wouldn't seem quite so funny.
|
|
|
|
|
Smitha Vijayan wrote:
Keeping a backup image in memory can be one option. But when it comes to undo-ing multiple actions, it might become inefficient
I would keep two images in memory, the original and the current version. Then each time you perform an operation on it create and store some data that tells what that operation was. When you undo something, take the last operation off the stack of operations, then starting with the original image perform each operation.
You may want to limit the number of operations allowed to be undone, or come up with some other variant of that (every 8-32 operations create a new 'starting' image, etc).
James
"The elastic retreat rings the close of play as the last wave uncovers
the newfangled way.
But your new shoes are worn at the heels and
your suntan does rapidly peel and
your wise men don't know how it feels to be thick as a brick."
"Thick as a Brick" from Thick as a Brick, Jethro Tull 1972
|
|
|
|
|
Thanks James.
James T. Johnson wrote:
You may want to limit the number of operations allowed to be undone
I intend to do that
Smitha
Whenever I see an old lady slip and fall on a wet sidewalk, my first instinct is to laugh. But then I think, what if I was an ant, and she fell on me. Then it wouldn't seem quite so funny.
|
|
|
|
|
Hey what's up everyone..
I recently compiled a product using release instead of debug and tried to run it on a machine without VS.net. It gives me some errors... for some reason the exe didn't include some of the .dll's needed for the actual .exe to run.
If someone could point lme in the right direction that would be awesome.
Thanks...
|
|
|
|
|
Hey nascokeg!
Do you have .net runtime over the target machine?
|
|
|
|