|
hi all
i want to make a remoting applications in which i have some events which i want to handle on my clients,but i dont know how to register events on my clients,
any example code, ane help will be highly appreciated,
thanks in advance
hello
|
|
|
|
|
I know this is not the answer you are looking for but when dealing with remoting then keep it simple and stick to method calls only over the network ... using Events with remoting is very sticky bizz. There's a whole lot of issues that make event handling with remoting a bitch. A way to simunate it is to have an event at both ends ... so a remote call triggers an event ..
But if you really really really wants to use events (the whole u have to seriealze everything sent over the network nightmare .. )
Search the remoting section here on Codeproject .... there's no perfect solution.
|
|
|
|
|
Is it possible to just simply output a byte reprisentation of an int as a string.. for example out put 10 as "1010".
Or do I have to loop through the number and do all the division manualy?
Thanks.
|
|
|
|
|
|
good morning every1..im in a middle of something..
im taking a C# course and my assignment is to move a button using Thread....
this is the link for the form:
[url=http://www.0zz0.com/realpic.php?s=3&pic=2007/03/18/23/89686027.jpg][img]http://www3.0zz0.com/thumps/2007/03/18/23/89686027.jpg[/img][/url]
i wanna move it by pressing de Start button and pause it then resume it
and this is the code
/////////////////
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
private delegate void Moveobject(string m);
private Thread g = null;
public Form1()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
label1.Text = DateTime.Now.ToString();
}
private void button6_Click(object sender, EventArgs e)
{
//
button6.Enabled = false;
g = new Thread(new ThreadStart(move));
g.Start();
}
//
private void move()
{
Moveobject mv = new Moveobject(moveitinpanel);
for (int x = 0; x < 100; x++)
{
for (int y = 0; y <= x; y++)
{
if (x >= y)
y++;
this.Invoke(mv, x.ToString());
//this.Invoke(mv, y.ToString());
}
}
}
//im stuck here
private void moveitinpanel(int x, int y)
{
button7.Location = x;
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
//
private void button4_Click(object sender, EventArgs e)
{
if (g != null)
{
if (g.ThreadState == ThreadState.Running)
{
try
{
g.Suspend();
button4.Text = "resume";
}
catch (Exception ex)
{
}
}
if (g.ThreadState == ThreadState.Suspended)
{
try
{
g.Resume();
button4.Text = "pause";
}
catch (Exception ex)
{
}
}
}
}
//
private void button5_Click(object sender, EventArgs e)
{
if (g != null)
{
try
{
button6.Enabled = true;
g.Abort();
}
catch (Exception ex)
{
}
}
}
}
}
plz if ne1 knows...let me no
thank u very much
|
|
|
|
|
aymolly wrote: //im stuck here
private void moveitinpanel(int x, int y)
{
button7.Location = x;
}
If you look at the documentation you'll see that Location is a Point structure so what you want is:
button7.Location = new Point(x, y);
|
|
|
|
|
here your delegate function have only one parameter "string m"
private delegate void Moveobject(string m);
But in the function your are trying to use int x and int y;
Please try to change the delegate as
private delegate void Moveobject(int x, int y);
My small attempt...
|
|
|
|
|
You might want to try replying to the original poster.
|
|
|
|
|
Hi,
I'm using a NumericUpDown control (C# .NET 2.0 Windows Form) so user can enter a quantity value.
After the WinForm's data is saved, I want to reset the NumbericUpDown control to it's default value (1).
Using this code works if any value is in the box:
numericUpDown_Quantity.Value = 1;
but if the user removes all text (values) from the NumericUpDown box, it does not paste the 1 back into the box.
The value has updated in memory (if you click UP, the next value is 2), but the box still shows empty. I've tried:
numericUpDown_Quantity.Update();
numericUpDown_Quantity.Refresh();
numericUpDown_Quantity.ResetText();
Any help would be appreciated.
Thanks,
Ron
-- modified at 18:02 Sunday 18th March, 2007
|
|
|
|
|
You tried everything, except setting the controls Text property, which is sperate from it's Value property.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thanks Dave,
I didn't realize I could use the Text property becuase it's not listed in IntelliSense.
It works great... I'm not sure why it's not listed in IntelliSense.
I've noticed that if the Up or Down buttons are used, this problem does not occur.
Only if the user deletes the text before Up/Down does Value=1 not work.
Ron
|
|
|
|
|
Yeah, that's why I do my research in the documentation instead of Intellisense. There's lots of hidden stuff in the docs that you'll never see anywhere else.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
dear
if we have a timer counts to 10 seconds and 10000 tick .
how can we put the x coordinate of the mouse move every tick of the timer in an array of 10000 elements .?
thank you
ahmad al-omar
|
|
|
|
|
Use Cursor.Position to find out where the mouse is.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
First declare array:
Point[] coordinates = new Point[10000];
And in method executed when timer ticks, use this code:
points[i] = Cursor.Position;
|
|
|
|
|
hi
i want to use Trigger in Sql Server 2005, please give me an example that how to use Triggers for Insert,Update and Delete events ..
thanks
|
|
|
|
|
Which bit are you stuck on ? Which of the many websites that offer help on this have you looked at ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
can u say me which site has example for Triggers ??
|
|
|
|
|
Here[^]
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi all! It's my first time to write, hope somebody can help me
I am creating an application that at a certain point opens an all screen form formed by a "grid" of buttons.
I would like some of these buttons to visualize (besides a title) an image on them, that may be modified (e.g. become semi-transparent)at run-time: at the moment an event is fired (in particular clicking on the same button).
How should I do? Should I use the BackgroundImage or Image of the Button class? Should I put a PictureBox on the button? Or should I use to create my buttons another class than Button, maybe more complex and suitable for my purpose?
I already tried something, but with not much success!
Sorry for my English, thanx for your help!
Davide
|
|
|
|
|
Derive a class from Button, handle the paint event, and draw your image whatever way you like.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I'm building an application that needs to sign some text. and than save the text and the signature in a file. Another application than reads this file and verifies it's contents using this hash. For this to work as I want, I need to convert the byte array containing the signature to a string to put at the end of the file. Next the recipient reads the string and converts it back to an byte array so the text can be verified.
I us the next code example to test. there are two blocks of code one using Encoding.Default and one using Encoding.Unicode. Using encoding.default works and give the correct answer true, the other does not.
Can anyone explain why using encoding.unicode doesn't work, or at least how to do the string <-> byte array conversions codepage independent?
<br />
using System;<br />
using System.Collections.Generic;<br />
using System.ComponentModel;<br />
using System.Data;<br />
using System.Drawing;<br />
using System.Text;<br />
using System.Windows.Forms;<br />
using System.Security.Cryptography;<br />
<br />
namespace WindowsApplication1<br />
{<br />
public partial class Form1 : Form<br />
{<br />
public Form1()<br />
{<br />
InitializeComponent();<br />
<br />
<br />
RSACryptoServiceProvider RSA = new RSACryptoServiceProvider();<br />
<br />
byte [] signature = RSA.SignData(Encoding.Unicode.GetBytes("test"), "SHA1");<br />
<br />
<br />
string temp = Encoding.Default.GetString(signature);<br />
signature = Encoding.Default.GetBytes(temp);<br />
<br />
bool verified = RSA.VerifyData(Encoding.Unicode.GetBytes("test"), "SHA1", signature);<br />
<br />
MessageBox.Show(verified.ToString());<br />
<br />
}<br />
}<br />
}<br />
|
|
|
|
|
The reason that you have problem decoding the signature to a string, is that it is not at all an encoded string to begin with.
When you are decoding it as if it were an encoded string, it depends on what encoding you are using and the content of the signature how much data you lose in the process.
If you want to send the signature as a string, just use Convert.ToBase64String and Convert.FromBase64String to get a string representation of the byte array and to get the byte array back.
---
single minded; short sighted; long gone;
|
|
|
|
|
I'm not going to pretend I completely understand your answer. I did however test using convert to and from base64 and it seems to work correctly and should be completely system independent as I understand it. I defenitely need to read up on my understanding of encodings.
Thanks for the quick answer!
|
|
|
|
|
I need help,
I had these sintax select id as random from table where id = '1', but this not help me.
If anybody can help me to write good sintax for select id random from a table
|
|
|
|