|
Save the byte array to a stream.Then use Image.FromStream(ms) to create a Image object.
MemoryStream ms=new MemoryStream(bytes);
Image img=Image.FromStream(ms);
|
|
|
|
|
Thanks, it works.
But do you how i can use that Image in an imagebox? i am getting a cannot implicitle convert type 'System.Drawing.Image' to 'System.web.UI.Webcontrol.Image'
|
|
|
|
|
Hi,
I had created one desktop application in C#. I am providing that application to download from a web application.But i need to download some data from webapplication,while downloading the C# application.Do i need scripting for that?
What cam i do for that?
My small attempt...
|
|
|
|
|
i need some help for using c# wiht clusters.
i want to know Is there any support available in c# for cluster programming?
|
|
|
|
|
well I think there's a lot to offer in C# for cluster programming as well.
I didnt know it till just now after googling it out u know.
|
|
|
|
|
ok thanx for informing me .
|
|
|
|
|
|
Hi frnz,
I'm writing a small application which manipulates the images and their format...my requirement is that i want to set the transperency of the image at runtime...i mean the user can choose how much transperency he wants for the image...the bitmap class has a method which sets the image full transperent but it is of no use for me as i need diff transperency...plz help me in this...
thanx in advance...
|
|
|
|
|
Im trying to implement a simple find text on a editor im working on.
On my find form, i have this button called "Find", here is the code for when you press it:
private void FindButton_Click(object sender, EventArgs e)
{
// Initialize the return value to false by default.
int returnValue = -1;
// Ensure that a search string has been specified and a valid start point.
if (FindTextBox.Text.Length > 0 && 0 >= 0)
{
// Obtain the location of the search string in richTextBox1.
int indexToText = EditingArea.Find(FindTextBox.Text, 0, RichTextBoxFinds.MatchCase);
// Determine whether the text was found in richTextBox1.
if (indexToText >= 0)
{
returnValue = indexToText;
}
}
}
But, when i try to build the solution, i keep getting these two error:
Error 1 (Warning - not major but i wanna get rid this stupid warning)
Solution_Name.Editor.ContextMenu' hides inherited member 'System.Windows.Forms.Control.ContextMenu'. Use the new keyword if hiding was intended. C:\Users\Admin\Documents\Visual Studio 2005\Projects\Solution_Name\Solution_name\Editor.Designer.cs
Error 2 - (Critical error, wont let me compile at all)
The name 'EditingArea' does not exist in the current context
The "EditingArea" is the name of the RichTextBox on the main form "Editor". The "Find" form is also on the same solution, same project. So, why can't it find it???
|
|
|
|
|
I decided to add the namespace of the editor front of it like this:
Editor.EditingArea.Find(....
Now, I got this error:
Editor.EditingArea is inaccessible due to its protection level
So, i went back to my main form and made the RichTextBox (called Editor) and made the member "public" and tried to build again. Now im getting this error:
An object reference is required for the nonstatic field, method, or property
How do i fix this? Im i even doing the "Find Text" correctly?
|
|
|
|
|
I think I get it. You're doing the type of thing where you have your main editor screen, and then a Find dialog pops up over the editor, like the Visual Studio find dialog does.
You want the Find to call back to the editor to highlight the search text.
You're making the call to Find() correctly, but you need a reference to the actual RichTextBox that is your editor.
My suggestion would be to either
a) raise an event from your Find dialog telling the main editor that a search has been requested, and let the editor perform the search; or
b) pass a reference to the RichTextBox into the Find dialog.
Approach b) is the easiest, but approach a) is more in line with OOP principles, and it is more extensible (what if you decide you want to expand the search capabilities.. for everything you add, you'll have to pass new information between the forms, rather than just putting it all into an event).
------------
Cheers,
Patrick
|
|
|
|
|
Thanks patrick for that suggestion, since im very new to c#, i haven't got the slightest idea what you've just said...
While trying to figure this "Find Text" thing out, i came up with this:
Editor form = new Editor();
int position = form.EditingArea.Find(FindTextBox.Text, 0, RichTextBoxFinds.None);
form.EditingArea.SelectionStart = form.EditingArea.SelectionStart + position;
but everytime i type into my editor and try to look for it, the program keeps trowing exception that -1 is not a valid selection start.
Can anyone show me how in the world you implement a simple text search for a RichTextBox ?
|
|
|
|
|
The error is bcos the value of position will always be ZERO.
Reason:
=======
Editor form = new Editor();
--This will create a new form window
which will have the RichtextBox control without any text.
So, obviously the Find function will retrun -1.
Regards,
Arun Kumar.A
|
|
|
|
|
So how can i work with another form's content without creating a new instance of it?
What you just said makes sense to me, however, i have no idea how to fix this. A suggestion would be much appreciated...
|
|
|
|
|
Try this:
Create 2 forms:
1.This form should contain the RichText box control and a button to open
the second form.
2.This form should contail a TextBox and a button to find the text
entered in the TextBox.
code for Form1(Show find Dialog button):
========================================
Form Form2=new Form();
Form2.RichTextBoxToFind=EditingArea; //Creating instance for Form2.
Form2.Show();
code for Form2:
===============
Have a public member in the class:
class Form2:System.......
{
public RichTextBox RichTextBoxToFind;
FindButton_Click()
{
int position = RichTextBoxToFindFind(FindTextBox.Text, 0, RichTextBoxFinds.None);
RichTextBoxToFind.SelectionStart = RichTextBoxToFind.SelectionStart + position;
}
}
This is the simplest way of doing this.
But we have to do like how Mr.Patrick suggested.
Hope , this helps U.
Regards,
Arun Kumar.A
|
|
|
|
|
Hi Arun Kumar, ask him to do the work.
Let him work on the application what he got.
if he get any error we can help here dont help him by providing the code .
pls suggest the ideas for developing the application.Dont give him the code as you have provided here.
Regards,
Satips.
|
|
|
|
|
Thank You Mr.Satips.
I will follow Ur suggestion.
Regards,
Arun Kumar.A
|
|
|
|
|
|
this article will help you in developing your application.
Regards,
Satips.
|
|
|
|
|
Hi,
I want to filter the productID that starts with "MDF", so I use
bindingsource1.filter = "productID like 'NAPLE 5'-02'" (look like sql query), but it's not working. After that I corrected bindingsource1.filter = bindingsource1.filter ="productID like 'NAPLE 5%-02'" , it's also not working and appear error "The expression contains an invalid string constant:'. "
Somebody could correct the code will be appreciated.
Thanks in advance.
It seem to be a solution or an answer.
|
|
|
|
|
phantanagu wrote: I want to filter the productID that starts with "MDF"
for what ur saying here it should be something like this, I think..
bindingsource1.Filter = "ProductID LIKE 'MDF%'";
phantanagu wrote: bindingsource1.filter = "productID like 'NAPLE 5'-02'"
What ur trying to do here is a ? for me
hope it helps
Rocky
|
|
|
|
|
Hi,all
I'm looking for some regular expressions to check whether a string is a File/Folder path.Anyone can help me?
Thanks!
|
|
|
|
|
^(([a-zA-Z]\ |(\\))(\\{1}|((\\{1})[^\\]([^/:*?<>"|]*))+)$
this might be helpful to u, I havent tried it out myself though but I've googled it out right now.
|
|
|
|
|
Thanks a lot!
It works excellent.
I find a small bug in it.The regular will match
c:\hello\dl\\\\\\\\\\\\\\\\\sdfsdfsdf\\asdf.
|
|
|
|
|
Hi... could anybody help me?? i gt this error "Error 4 Expected class, delegate, enum, interface, or struct".. i don't understand what it means.. can someone solve for me.. this is my code..
string{} tx_data = new string{13};
string{} rx_data = new string{9};
public int i;
|
|
|
|