| |

VerySource

 Forgot password?
 Register
Search
View: 1322|Reply: 12

Simple question.

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-2-17 10:00:02
| Show all posts |Read mode
Now I want to display five columns as follows:

Product Code Product Name Product Category Code Product Category Name Button Bar

 01 Apple A001 Fruit Selection ..
 02 Beef B001 Meat Selection:

As shown above, extract the product code and product name from the database, then click the select button in the fifth column,
A pop-up tree of product categories is displayed. Select the category to return and display the information in 3 or 4 columns. . .

How to achieve winform?

Help, give me some code, thank you. .
Reply

Use magic Report

0

Threads

17

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

Post time: 2020-4-20 10:30:01
| Show all posts
When loading, the first two columns of data are fetched from the database. Click combobox and display the results in three or four columns.
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-4-21 13:30:01
| Show all posts
to:ak41sl

Can you be more specific? Thank you.
Anxious, winform is not very familiar, it was developed by webform before. .
Reply

Use magic Report

0

Threads

4

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-4-24 09:00:01
| Show all posts
You can access each other by setting the public attribute of a commodity code in each of the two windows
Reply

Use magic Report

0

Threads

16

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

Post time: 2020-5-1 10:30:01
| Show all posts
a suggestion:
Columns 3 and 4 are empty first, and then click the select button, a window pops up to select the product category. After selection, click OK, the small window closes, and the results are displayed in columns 3 and 4. You want this result, I guess you The problem is not here, but how to return the result after selecting the category, right? If so, a workaround:
1. Define the event in the pop-up selection category window:
public delegate void SelectedEventHandle (string category, string category name);
public event SelectedEventHandle Selected;
Triggered at the "OK" button in this window:
Selected ("A001", "Fruit");
this.Close ();
In the window "Select" button shown earlier (assuming the category selection window class is FormSelect):
FormSelect fs = new FormSelect ();
fs.Selected + = new Form2.SelectedEventHandle (f_Selected);
fs.show ();
Note the method f_Selected:
void f_Selected (string category, string category name)
        {
            // throw new Exception ("The method or operation is not implemented.");
            // here you can display categories etc. into columns 3 and 4
        }
Reply

Use magic Report

1

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-5-1 14:00:02
| Show all posts
Also I use datagrid, how to add button column in the fifth column?
Reply

Use magic Report

0

Threads

16

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

Post time: 2020-5-2 01:30:02
| Show all posts
Another solution:
Define the method in the category selection window:
string [] lbs = new string [2];
public string [] Selected ()
{
    this.ShowDialog ();
    return lbs;
}
After selecting the category, in the click event of the OK button in this window:
lbs [0] = "A001";
lbs [1] = "fruit";
this.close ();
In the display window:

FormSelect fs = new FormSelect ();
string [] lbs = fs.Selected ();
// Show the return value later

Combined with the previous solution, it is a more convenient solution
Reply

Use magic Report

1

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-5-3 02:00:02
| Show all posts
to:maodanyun
Can you talk about how to set up the front window, for example, the button column, pass 3, 4 column id
Wait, thank you. .
Reply

Use magic Report

0

Threads

16

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

Post time: 2020-5-3 03:15:01
| Show all posts
You can add buttons using the Add method of the Controls of the controls, and the code is more troublesome.
Reply

Use magic Report

0

Threads

16

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

Post time: 2020-5-4 09:00:01
| Show all posts
Are you using datagrid or dataGridView? There should be a DataGridViewButtonColumn in the column type of dataGridView?
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list