|
dear leppie
thanks for the code snippet.
but i dont understand the logic which u try to explain me through ur code snippet.
Could u comment the source code and send it to me?
Do u think RichTextBox is not good for Line numbering ,auto indentation ,
ruler bar (on top of the text control similar to MS-Word)?
I downloaded xacc AdvancedTextBox also and its so nice ..but takes lot time
to understand the full source code.
Please help me.
"They can because they think they can" - Voltaire
|
|
|
|
|
I am sure there is a simple way to do this, but heck if I can figure it out tonight. Does anyone know of a way to float a child Form (say tool window) in an application properly?
I have a main Form, and I create a new child Form (tool window) with a parent of null and TopMost set to true. This allows my tool window to float over the app nicely. The problem is when I switch to another application, my toolwindow is still staring me in the face since it is TopMost!
How can I make it float topmost only when the application is active? Is there a way to distinguish between the application losing activation because the user switched to another app or because they clicked on the child tool window (which causes a deactivate)?
Any ideas would be greatly appreciated!
Michael
Developer, Author, Chef
|
|
|
|
|
Reset TopMost back to false and set the Owner property of your floating window to the main application form. See the Form.Owner property documentation in the .NET Framework SDK for more information.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Bah! I knew I was overlooking something simple, but was too brain-fried last night to come up with it. Many thanks again for input Heath!
Michael
Developer, Author, Chef
|
|
|
|
|
hello
I have got a nice doubt to ASK
I have created a user control in C#.net.
and that control is also implementing few interfaces.
but the problem is that ,when i integrate this
control on to a windows form, we can see the user
control for sometime, or days but after few days or
so we can't see it at design time.But is there in the form
at run time. We are using visualstudio 6.0 sourcesafe and
and during integration process most form has got
more than 10 controls. I have mailed it to few discussion
forums but didnt got a satisfying reply.
bye
jithesh
|
|
|
|
|
I wish to know, if there is any way to send an image from one form to another using a socket conection. Say like one form can send an image to another form on a remote computer that recieves it and views it. Can it be done just using sockets? Thanks in advanced
|
|
|
|
|
One of the overloads for the Image.Save() method takes a System.IO.Stream. You could stream it memory, then send those bits via socket. Something like...
using System.IO;
using System.Net.Sockets;
Bitmap bmp = new Bitmap(@"c:\mypic.gif");
System.IO.MemoryStream memImage = new MemoryStream();
bmp.Save(memImage,System.Drawing.Imaging.ImageFormat.Gif);
byte[] data = memImage.ToArray();
Socket socket = new Socket(...your options here...);
socket.Send(data,0,data.Length,SocketFlags.None);
Hope that gets you started!
Michael
Developer, Author, Chef
|
|
|
|
|
Michael's suggestion is correct but you will also have to make sure that the client and server both send/receive the entire image. This means either putting a delimiter at the end of the image data or sending a 4 byte 'image data size' value before the image data. This is a basic socket principle so you don't not send or not receive the entire application level message.
|
|
|
|
|
Does anyone know how to increase the line spacing of items in a checkedListBox control, thank you in advance for your comments.
Interlocked
|
|
|
|
|
Hello, i have this web browser application which uses the AxWebBrowser control. It works pretty well except that i doesn't support auto complete. e.g. when u double click on an empty textbox, it will display a list of previous entered values.
Does it need special coding to handle it or can it be just a simple turning on of certain option?
<font=arial>Weiye Chen
When pursuing your dreams, don't forget to enjoy your life...
|
|
|
|
|
|
Hi All,
For my .NET Windows application (C#), I build the installation setup from .NET framework (Setup & Deployment Project).
I am unable to find the property, which I can set to give user the choice for installation i.e. whether installation will take place for the logged in user or for everyone [Everyone /"Just me" thingy]
Any help is appreciated
Thanks
Ruchi
|
|
|
|
|
So u are in C# right ?
good shoot.
First you create a new project
File > New >project >Setup and deployment > Setup. Just mentione the name and location where you want to keep your setup file.
Second Stage > Right now you are in FileSystem Window. Am i right ?
Ok. Here you can see Application Folder ,user's Desktop, User's Programs Menu some thing like this.
third stage > Choose add project from File Menu and choose existing project. After this you have to mention for which project file that you need to create setup file. Choose you project directroy.Choose the file
yourprojectname.csproj.
Just wait a second. After this stage right click the application folder and choose the option Add > Project Output.
Choose all in ProjectListBox except DebugOut Put And Source File. Then choose Cofiguration Tab and select Active.
then click ok.
You will get some file in the second Splited window of FileSystem Window.
Here you can view the two part of FileSystem Window.One is FileSystem on Target Machine and the other window is Output files. Select the application folder and right click on the next window.You will get a popup window with an option add. Choose the Add and go for the File option.
Here you can choose all aditional resouces file that you are going to use in your project.eg. icon's, configuration file etc.
Choose the all required files holding ctl key and add it. Here you got some more file right. Ok.
Next thing is if you want to give short cut to your project, then right click on the file
Primary output from xxxx(Active) and choose create shot cut. Now u will get one more file and rename it to what ever you want.
Choose the property of that shortcut and choose the Icon and browse in application folder. In application forlder you will get your project icon.
And create the project(build). If your project is error free then your effort will always successfull.
enjoy coding.
hai, feel free to contact
Sreejith SS Nair
|
|
|
|
|
Thanks Sreejith for the reply.
Actually I could create the setup project, but problem I have is in specifying property such that at the time of installation it asks me, if the installation is to be done for "All Users" or "Logged in user"
Thanks
Ruchi
|
|
|
|
|
I don't know what in the hell the other guy is trying to tell you, but I've been developing installer packages since Windows Installer 1.0 beta.
The solution is simple: the ALLUSERS property is what you're looking for. You can both get and set this property.
The default Windows Installer project in VS.NET does include a dialog that sets this accordingly (see the Windows Installer SDK in MSDN[^] for more information). This in turn changes the meaning of pre-defined folder properties, like DesktopFolder . Depending on the user's access privileges and the setting of ALLUSERS , the DesktopFolder - for example - would point to either the user's desktop folder or the All Users' desktop folder.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks Heath for the reply.
The solution you suggested works by specifying command line params like this
msiexec /I mysetup.msi ALLUSERS=2
But I couldn't find a way such that I set this property at the time I create MSI file from the .NET "Setup & Deployment" project.
I am sorry I am a little novice there. Please suggest.
Thanks
Ruchi
|
|
|
|
|
i need a solution for making an event (like click event..) on the scrollbar of the TreeView.
|
|
|
|
|
Extend the TreeView with your own class and override WndProc . Inside, you can handle the scroll bar notification messages that can fire whatever events you want, such as adding your own. For example, you could have a Scroll event and fill it's EventArgs derivative with scroll information, which you can also get from the WParam and LParam properties of the Message that's passed as a reference to your overridden WndProc (just don't forget to call base.WndProc ).
You can find more information about the scroll bar notification messages - which are sent to the parent control, i.e. the TreeView - in the Platform SDK documentation for Scroll Bars[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I'm building some Control that displays a form that let's me do some operations. (like the combobox, datetimepicker, etc.)
Now, I nees that the poped area will be on top of all windows like the regular ComboBox dropped region, and wouldn't be trimmed by the parent control rectangle.
What is the currect technique for this?
(Sorry about my terrible English, I'm not an american.)
|
|
|
|
|
One approach would be to...
Make the popped-up area a parentless, topmost Form that holds whatever custom control you wish. You can initialize it something like:
protected void InitMyPoppedForm
{
...
this.TopMost = true;
this.Deactivate += new System.EventHandler(this.MyPoppedForm_Deactivate);
...
}
Then you need to handle the Form's deactivate event, which fires when the user clicks anywhere else other than inside the MyPoppedForm. At the very least this should simply close the popped up form (like a combobox "rolls up" when it loses focus).
Something like:
private void MyPoppedForm_Deactivate(object sender, System.EventArgs e)
{
Hide();
NotifySomeoneILostFocus();
}
Hope that helps.
Michael
Developer, Author, Chef
|
|
|
|
|
I've tried this approach, but when the form poppes up, thw hosting form is loosing focus. i.e. the caption color of the form changes to gray.
In the combobox it stays blue even when it dropped down.
What can the reason for this?
Thanks for answering.
|
|
|
|
|
Hi-
I have a c# program which encrypts a password and stores it in an access database (into a text field with 150 char). When I try to decrypt it, it tells me "bad data".
Here is how I encrypt it:
//Create a UnicodeEncoder to convert between byte array and string.
UnicodeEncoding ByteConverter = new UnicodeEncoding();
//Create byte arrays to hold original, encrypted, and decrypted data.
byte[] dataToEncrypt = ByteConverter.GetBytes(this.editHeartsPsWd.Text.ToString());
byte[] encryptedData;
//Create a new instance of RSACryptoServiceProvider to generate
//public and private key data.
RSACryptoServiceProvider RSA = new RSACryptoServiceProvider();
//Pass the data to ENCRYPT, the public key information
//(using RSACryptoServiceProvider.ExportParameters(false),
//and a boolean flag specifying no OAEP padding.
encryptedData = HallenSchool.HallenFunctions.RSAEncrypt(dataToEncrypt,RSA.ExportParameters(false), false);
string sSQL="UPDATE Staff SET Staff.HeartsPsWd = '" + ByteConverter.GetString(encryptedData) + "' WHERE Staff.[Staff Code]= " + this.editStaff_Code.Text.ToString();
Here is how I decrypt it:
//Create a UnicodeEncoder to convert between byte array and string.
UnicodeEncoding ByteConverter = new UnicodeEncoding();
//Create a new instance of RSACryptoServiceProvider to generate
//public and private key data.
RSACryptoServiceProvider RSA = new RSACryptoServiceProvider();
byte[] decryptedData;
byte[] encryptedData;
string strHeartsPsWd = this.editHeartsPsWd.Text.ToString();
strHeartsPsWd = strHeartsPsWd.Trim();
encryptedData=ByteConverter.GetBytes(strHeartsPsWd);
if (!(encryptedData.Length==0))
{
decryptedData = HallenSchool.HallenFunctions.RSADecrypt(encryptedData,RSA.ExportParameters(true), false);
this.editHeartsPsWd.Text= ByteConverter.GetString(decryptedData);
}// not empty password
Thanks for your help!
JK
|
|
|
|
|
First, don't use Text.ToString : Text already returns a string - your call to ToString is completely unnecessary.
Second, you're treating binary data as text, which can cause encoding problems. If you want to encode binary data as text, then you should chain something like the ToBase64Transform or FromBase64Transform or simply use Convert.ToBase64String or Convert.FromBase64String .
Finally, the problem is most likely in your RSADecrypt method that you're not displaying. Everything you're doing besides that is simply encoding and decoding and should not throw such an exception that uses the "Bad data" message.
Please be more specific. What exception is being thrown and from which line? Step through your code and determine exactly where the error occurs.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi -
The RSADecrypt is:
static public byte[] RSADecrypt(byte[] DataToDecrypt, RSAParameters RSAKeyInfo,bool DoOAEPPadding)
{
try
{
//Create a new instance of RSACryptoServiceProvider.
RSACryptoServiceProvider RSA = new RSACryptoServiceProvider();
//Import the RSA Key information. This needs
//to include the private key information.
RSA.ImportParameters(RSAKeyInfo);
//Decrypt the passed byte array and specify OAEP padding.
//OAEP padding is only available on Microsoft Windows XP or
//later.
return RSA.Decrypt(DataToDecrypt, DoOAEPPadding);
}
//Catch and display a CryptographicException
//to the console.
catch(CryptographicException e)
{
System.Windows.Forms.MessageBox.Show(e.ToString());
return null;
}
} //end RSADecrypt
***** The exception is thrown at the return RSA.Decrypt(DataToDecrypt, DoOAEPPadding);
statement.
Thanks for your help!
JK
JK
|
|
|
|
|
Like I mentioned before, it's probably because you're treating binary data as text. Try just storing the encrypted data in a byte[] array and then decrypt that, as opposed to putting it in a TextBox (or whatever you are storing it in) and decrypt that and see what happens.
Microsoft MVP, Visual C#
My Articles
|
|
|
|