0% found this document useful (0 votes)
6 views1 page

Shopazon Product Details Display

The document defines a Product class with properties for id, name, price, and quantity, and initializes an array of Product objects. It includes event handlers for loading a form and a button click, where the button click searches for a product by id and displays its details in a list box. The code is written in C# and is likely part of a Windows Forms application.

Uploaded by

23134055
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views1 page

Shopazon Product Details Display

The document defines a Product class with properties for id, name, price, and quantity, and initializes an array of Product objects. It includes event handlers for loading a form and a button click, where the button click searches for a product by id and displays its details in a list box. The code is written in C# and is likely part of a Windows Forms application.

Uploaded by

23134055
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

{

public int id;


public string name;
public double price;
public int quantity;

public Product(int i, string n, double p, int q)


{
[Link] = i;
[Link] = n;
[Link] = p;
[Link] = q;
}
}

Product[] P = new Product[4]{new Product (0,"wheel", 12.11 , 15 ) ,


new Product (1,"pedal", 8.22 , 11 ),
new Product (2,"chain", 8.33 , 12 ),
new Product (3,"seat", 4.55 , 8 ) };
private void Form1_Load(object sender, EventArgs e)
{

private void button1_Click(object sender, EventArgs e)


{
for (int i = 0; i < [Link]; i++)
{
if (P[i].id == Convert.ToInt32([Link]))
{
[Link]("ID: " + P[i].id);
[Link]("Name: " + P[i].name);
[Link]("Price: " + P[i].price);
[Link]("Quantity: " + P[i].quantity);
[Link]("-------------------");

You might also like