Jump to content

Hi, I am new to c#, I am trying to code a page where select a button it will pass the image and its text to the other page, however, it shows me this error. (I was having an error with the code in bold and underlined )

An unhandled exception of type 'System.ArgumentException' occurred in System.Drawing.dll
Parameter is not valid.

(The first code was the image and message to be inserted)

(The second code was for the image and message to be inserted into the first code)

  

  First code

 public Booking(Image passingimage, string bandtitle)
        {           
            InitializeComponent();
            pictureBox1.Image = passingimage;
            bunifuCustomLabel5.Text = bandtitle;
        }

  public static void Shbooking(string bandtitle, Image passingimage)
        {
            Booking bk = new SoftwarePrj_LawZhiMing.Booking (passingimage,bandtitle);
            bk.ShowDialog();
        }

 

Second Code

   public partial class EandB : UserControl
    {

        Image passingimage;
       public static string passingtitle;

private void BunifuThinButton21_Click_1(object sender, EventArgs e)
        {
             ((Home)this.TopLevelControl).Hide();
             passingimage = pictureBox6.Image;
            passingtitle = bunifuCustomLabel2.Text;
            Booking.Shbooking(passingtitle, passingimage);
        }

     }


 

 


 

----------------------------PC Build--------------------------------

=========================================

CPU: Ryzen 2700x

M/B: Gigabyte AX370

GPU: Gigabyte G1 Gaming GTX 1080

RAM: KLEVV CRAS II RGB 16GB 3200Mhz

Case: Fractal Design Meshify C Blackout

Storage: Samsung 860 evo 256GB & WD Blue 1TB

PSU: EVGA 750W Gold+

=========================================

Aiming to get Secret Lab Omega

 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×