|
The Show method returns a value of the type DialogResult .
DialogResult result = MessageBox.Show("Hello world!");
The value of the return value reflects what the user did with the message box.
---
Year happy = new Year(2007);
|
|
|
|
|
all my messageBoxes are displaying OK buttons only.
how do i get to add a Cancel button on my MessageBox??
Saira
|
|
|
|
|
Hello,
System.Windows.Forms.MessageBox.Show("your text", MessageBoxButtons.OKCancel);
All the best,
Martin
|
|
|
|
|
hi,
the code gives the following error
the best overloaded method match for System.Windows.Forms.MessageBox.Show("your text", MessageBoxButtons.OKCancel); has some invalid arguments
if i convert the second argument to string it doesn't display the cancel button either.
whats wrong with it??
|
|
|
|
|
Sorry,
You have to set the:
using System.Windows.Forms;
or use:
System.Windows.Forms.MessageBoxButtons
All the best,
Martin
|
|
|
|
|
hey Martin
i checked it out,
There is no overloaded method for the Show function that takes a String and MessageBoxButton as argument.
|
|
|
|
|
Yep, you are right!
Haven't checked it, Sorry!
|
|
|
|
|
i had using System.Windows.Forms; set
how do i use:
System.Windows.Forms.MessageBoxButtons
and where do i put it???
|
|
|
|
|
Sorry,
Gave you the wrong parameters!
Look at 'quitesmart's answer.
|
|
|
|
|
write this:
<br />
MessageBox.Show("Your text", "Your message Caption", MessageBoxButtons.OKCancel);<br />
|
|
|
|
|
ThankYou
you really are quiteSmart
Regards
Saira
|
|
|
|
|
Saira Tanwir wrote: you really are quiteSmart
thanks a lot,
if you need any help be free to contact me on my msn address jamilaboukhalil@hotmail.com
|
|
|
|
|
Hi
I have a 'new person' form that i want to start with a height of 276 and if the person will have a photo the form to open up to 440. So for eas of working with it, in the designer it is 440 high, but I want it to open with 276. So I figured...
public frmNewPerson () {
InitializeComponent ();
Form.ActiveForm.Height=276;
}
would work, but it doesn't, it says...
Message="Object reference not set to an instance of an object."
and highlights the line Form....
So am I just putting this line of code in the wrong place or what?
TIA
Graham
|
|
|
|
|
have u tried to initiallize the form through the syntax
Form frm=new Form();
here Form is the name of the form that u are trying to manipulate and frm is its instance or objet that u have created for manipulating it.
try this approach as its worked for me.
hopefully this helps.
Saira
|
|
|
|
|
Saira
I just did that on the last form, to cause this form to appear so that doesn't seem the right thing to do.
Michael's suggestion has worked use - this.Height = 276;
Thanks
|
|
|
|
|
the-Yetti wrote: I have a 'new person' form that i want to start with a height of 276 and if the person will have a photo the form to open up to 440. So for eas of working with it, in the designer it is 440 high, but I want it to open with 276. So I figured...
public frmNewPerson () {
InitializeComponent ();
Form.ActiveForm.Height=276;
}
would work, but it doesn't, it says...
Message="Object reference not set to an instance of an object."
and highlights the line Form....
So am I just putting this line of code in the wrong place or what?
As you are in the constructor of the form, the ActiveForm property hasn't been initialised yet.
Try
this.Height = 276;
|
|
|
|
|
Put it in the Form's Load event instead of constructor.
private void frmNewPerson_Load(object sender, EventArgs e)
{
this.Height = 276;
}
|
|
|
|
|
That's what I thought, but I had tried ( as suggested by engsrini ) that I try it in the Load event, but it still failed. But thanks this.Height works.
|
|
|
|
|
Hi .
Need to Convert base64 string representing header of the binary field with image data.
//ds.Tables[6].Rows[1].ItemArray[2].ToString() contains base64string
{
Byte[] byt = Convert.FromBase64String(ds.Tables[6].Rows[1].ItemArray[2].ToString());
SaveToOut("image/jpeg", byt, true);
PerformScaleImage(contentType, content, Response, 150, 50);
MemoryStream stream = new MemoryStream();
stream.Write(buff, 0, buff.Length);
using (Bitmap img = new Bitmap(stream))/*---Giving invalid parameter exception-------*/
{
--------------------------}
}
Can you give details.
Srinivas
|
|
|
|
|
The error comes because you haven't reset the memory stream before reading it.
You should create a read-only memory stream from the array instead:
MemoryStream stream = new MemoryStream(buff, false);
Now the memory stream contains the data from the start, and you can read from it right away.
---
Year happy = new Year(2007);
|
|
|
|
|
The error is at the line pointing to ------(A)
MemoryStream stream = new MemoryStream();
stream.Write(buff, 0, buff.Length);
------(A)
using (Bitmap img = new Bitmap(stream))/*---Giving invalid parameter exception-------*/
{
--------------------------}
}
Srinivas S
|
|
|
|
|
Yes, I know that. Read my previous post again, and you might realise that.
---
Year happy = new Year(2007);
|
|
|
|
|
MemoryStream stream = new MemoryStream(buff, false);
After that also its giving same one
Invalid parameter for bitmap constructor.
|
|
|
|
|
I have tested it, and as expected it works just fine.
Where do you create the array buff , and what does it contain?
---
Year happy = new Year(2007);
|
|
|
|
|
Hi .
Need to Convert base64 string representing header of the binary field with image data.
//ds.Tables[6].Rows[1].ItemArray[2].ToString() contains base64string
{
Byte[] byt = Convert.FromBase64String(ds.Tables[6].Rows[1].ItemArray[2].ToString());
SaveToOut("image/jpeg", byt, true);
PerformScaleImage(contentType, content, Response, 150, 50);
MemoryStream stream = new MemoryStream();
stream.Write(buff, 0, buff.Length);
using (Bitmap img = new Bitmap(stream))/*---Giving invalid parameter exception-------*/
{
--------------------------}
}
Can you give details.
Srinivas S
|
|
|
|