|
i'm getting the menu container from another form..this is code..
frmMain obj_frmMain = new frmMain();
this.Menu = obj_frmMain.mainMenu1.CloneMenu();
HOW TO GET THE CLICK EVENT OR CONTROL(MENUITEM) IN MY FORM..
|
|
|
|
|
I assume your cloning of the menu was an attempt to take the events of the menu???
Wrong.
In the main form you will have to make a public accessor to your menu.
Then in your application:
frmMain mainMenu = new frmMain();
mainMenu.Menu.MyMenuOption.Click += new ClickEventHandler(MyEventHandler);
BTW: I see you are still using very old naming conventions in your code. To make it more usable you may want to read up on the Microsoft Naming Standards for .NET.
|
|
|
|
|
Hi there,
I am trying to write a procedure where my application can write some information to a file should the running executable crashes. The written info should be related to the crash, and it may be a help to understand why it happened. In C and C++, miini dump is used, what can I use for C# projects?
Please help
Many thnx
raff
|
|
|
|
|
You could attach a handler to Application.ThreadException and simply write the information of the exception to a file, this could be done by serialization. It depends on what information you want to save to disk.
Sig cops got me...
|
|
|
|
|
How did you generate minidumps in C/C++? You could get minidumps with C# also with the same method, and they'll typically contain more stack and memory information.
|
|
|
|
|
hi
i have problem in c#. how to create messenger like that yahoo.
thirumal rao
|
|
|
|
|
shri_scorpio wrote: how to create messenger like that yahoo.
By writing some code...
If you want a more specific answer than that, I am afraid that you have to ask a more specific question.
---
b { font-weight: normal; }
|
|
|
|
|
I think your problem is that you're knowledge in C# is not (yet) profound enough to develop a messenger application...
Determin first how you're going to send the data over the internet. If you know that, then you can ask here on CP what classes you use eg...
Good luck.
|
|
|
|
|
Hi,
You can find such application hare in codeproect only.....
<marquee>nishu
|
|
|
|
|
how to select the picture box on run time and how to resize this picture box?please help
|
|
|
|
|
hi
pictureBox1.Image = Image.FromFile("1.jpg");
pictureBox1.Size = new Size(width,height);
// hope i help you with resizing.....
Tamimi - Code
|
|
|
|
|
thanks..
but i want select the border and then resize that image
|
|
|
|
|
use a panel(base panel for the size you feel max for your streching)
in it put three panels and two splitter controls as following
p s p
s
p
dock them accordingly and you have it
p=> panel
s=> splitter
It is Good to be Important but!
it is more Important to be Good
|
|
|
|
|
Hi,
I tried encrypting and decrypting a string using the following Java code and key. And was successful.
Then, I used the following C# to encrypt and decrypt a string using the following C# code and key. And was successful.
But when i tried to encrypted using java and decrypted using C#, but it was not successful.
Can someone please help? THanks in advanced.
[JAVA code]
private static String algorithm = "DESede";
private static Key key = null;
private static Cipher cipher = null;
private static void setUp() throws Exception {
key = new SecretKeySpec("123456789012345678901234".getBytes(), algorithm);
cipher = Cipher.getInstance(algorithm);
}
public static void main(String[] args) throws Exception {
setUp();
byte[] encryptionBytes = null;
encryptionBytes = encrypt("This is a testing");
System.out.println("Recovered: " + decrypt(encryptionBytes));
}
private static byte[] encrypt(String input) throws InvalidKeyException,
BadPaddingException, IllegalBlockSizeException {
cipher.init(Cipher.ENCRYPT_MODE, key);
byte[] inputBytes = input.getBytes();
return cipher.doFinal(inputBytes);
}
private static String decrypt(byte[] encryptionBytes) throws
InvalidKeyException, BadPaddingException, IllegalBlockSizeException {
cipher.init(Cipher.DECRYPT_MODE, key);
byte[] recoveredBytes = cipher.doFinal(encryptionBytes);
String recovered = new String(recoveredBytes);
return recovered;
}
[C# Code]
static void Main()
{
try
{
TripleDESCryptoServiceProvider tDESalg = new
TripleDESCryptoServiceProvider();
// Create a string to encrypt.
string sData = "This is a testing";
// Encrypt the string to an in-memory buffer.
byte[] key = Encoding.UTF8.GetBytes("123456789012345678901234");
byte[] Data = EncryptTextToMemory(sData, key, key);
string Final = DecryptTextFromMemory(Data, key, key);
// Display the decrypted string to the console.
Console.WriteLine(Final);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
public static byte[] EncryptTextToMemory(string Data, byte[] Key, byte[] IV)
{
try
{
// Create a MemoryStream.
MemoryStream mStream = new MemoryStream();
// Create a CryptoStream using the MemoryStream
// and the passed key and initialization vector (IV).
CryptoStream cStream = new CryptoStream(mStream,
new TripleDESCryptoServiceProvider().CreateEncryptor(Key, IV),
CryptoStreamMode.Write);
// Convert the passed string to a byte array.
byte[] toEncrypt = Encoding.UTF8.GetBytes(Data);
// Write the byte array to the crypto stream and flush it.
cStream.Write(toEncrypt, 0, toEncrypt.Length);
cStream.FlushFinalBlock();
// Get an array of bytes from the
// MemoryStream that holds the
// encrypted data.
byte[] ret = mStream.ToArray();
// Close the streams.
cStream.Close();
mStream.Close();
// Return the encrypted buffer.
return ret;
}
catch (CryptographicException e)
{
Console.WriteLine("A Cryptographic error occurred: {0}", e.Message);
return null;
}
}
public static string DecryptTextFromMemory(byte[] Data, byte[] Key, byte[] IV)
{
try
{
// Create a new MemoryStream using the passed
// array of encrypted data.
MemoryStream msDecrypt = new MemoryStream(Data);
// Create a CryptoStream using the MemoryStream
// and the passed key and initialization vector (IV).
CryptoStream csDecrypt = new CryptoStream(msDecrypt,
new TripleDESCryptoServiceProvider().CreateDecryptor(Key, IV),
CryptoStreamMode.Read);
// Create buffer to hold the decrypted data.
byte[] fromEncrypt = new byte[Data.Length];
// Read the decrypted data out of the crypto stream
// and place it into the temporary buffer.
csDecrypt.Read(fromEncrypt, 0, fromEncrypt.Length);
//Convert the buffer into a string and return it.
return new ASCIIEncoding().GetString(fromEncrypt);
}
catch (CryptographicException e)
{
Console.WriteLine("A Cryptographic error occurred: {0}", e.Message);
return null;
}
}
|
|
|
|
|
VS 2003
C#: Windows Application - DataForm Wizard
3 records, Add 1 record
-----------------
Hi, I have a DataGrid and Textboxes link to the objCustomerDataset. When I add new record, after I click update button, the record is updated (Seen in Datagrid). The problem here is when I closed my form and relaunch, the pointer in the datagrid always point to the new record and the textboxes record (using DtatForm Wizard) to create is also at the new record. How do I reload the pointer to point at first record??
Note: I placed this.LoadDataset() at the form initialize.
|
|
|
|
|
hi, hope this will help
dataGrid1.CurrentCell = new DataGridCell(0,0);
Tamimi - Code
|
|
|
|
|
Hi, where do I insert this code?
|
|
|
|
|
hi
whereever you want !!!!!!!!
like when load the data, on button pressed
Tamimi - Code
|
|
|
|
|
I have an XmlNodeList and I just want to reverse the order of it. I have to keep it as an XmlNodeList because my repeater control (which I bind to it) depends on that.
/\ |_ E X E GG
|
|
|
|
|
Since the XPath function reverse is only for XPath 2.0, I can think of only two ways to do this:
1. Put your XML into a DataSet and use a DataView to tell it to sort in reverse order.
2. Use an XPathNodeIterator .
Option 2 is kind of difficult. Basically, instead of using an XmlDocument , you use an XPathDocument object to represent your XML. Then, you create an XPathNavigator from the document or from the node in the document that you want to start from. Use the navigator to Compile an XPathExpression object. Call AddSort on the XPathExpression to tell it to sort the nodes in reverse order (this is similar to how you would sort in an XSLT document). Then you can call the Evaluate method on the XPathNavigator to get an XPathNodeIterator , which you can bind to. The code really isn't that long, it just takes a while to figure out.
|
|
|
|
|
how can i made me application to have an intercactive interface like nero interfce ?
|
|
|
|
|
be creative
Tamimi - Code
|
|
|
|
|
Sir, i need help to make a chat room in C#.net. Kindly can you provide me any chat application source code.
|
|
|
|
|
|
All,
Are there any conditional defines for the /unsafe compiler switch? I have some code that I've written two versions for, one usafe (and much faster) and the other all "safe" code.
I now want to wrap the code in #if / #else / #endif blocks but need a "internal" conditional define that will select based on the presence of the /unsafe compiler switch.
Or... where can I get a list of "all" the VS.2005 C# "internal" conditional defines?
Thanks,
-Vino Rodrigues
|
|
|
|