| |

VerySource

 Forgot password?
 Register
Search
Author: alexjjj

ListBox problem

[Copy link]

5

Threads

19

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

 Author| Post time: 2020-1-5 19:15:01
| Show all posts
No, I mean, at runtime, can I enter data through the listbox in the page? ?
Reply

Use magic Report

0

Threads

64

Posts

35.00

Credits

Newbie

Rank: 1

Credits
35.00

 China

Post time: 2020-1-6 09:36:01
| Show all posts
"You want to take out the value in listbox1 and put it in listbox2 to display it." Isn't that what you said?
Reply

Use magic Report

0

Threads

15

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 United States

Post time: 2020-1-6 15:27:01
| Show all posts
Not quite understand what you mean. . .
Reply

Use magic Report

1

Threads

60

Posts

37.00

Credits

Newbie

Rank: 1

Credits
37.00

 China

Post time: 2020-1-6 15:51:01
| Show all posts
Does this mean that at runtime, if there is a button key, then the input data is inserted into the listbox. If so, it is OK
Reply

Use magic Report

0

Threads

10

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-1-6 16:15:01
| Show all posts
Text box, plus a button can be placed in LISTBOX! !!
Reply

Use magic Report

0

Threads

10

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-1-6 16:30:01
| Show all posts
The following is a sample code I made for reference only:

public class WebForm2: System.Web.UI.Page
{
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.ListBox ListBox1;
protected System.Web.UI.WebControls.Button Button1;
Ransom
private void Page_Load (object sender, System.EventArgs e)
{
// Place user code here to initialize the page
}

#region Web Form Designer Generated Code
override protected void OnInit (EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Forms Designer.
//
InitializeComponent ();
base.OnInit (e);
}
Ranch
/// <summary>
/// Designer supports required methods-don't modify with code editor
/// The contents of this method.
/// </ summary>
private void InitializeComponent ()
{
this.Button1.Click + = new System.EventHandler (this.Button1_Click);
this.Load + = new System.EventHandler (this.Page_Load);

}
#endregion

private void Button1_Click (object sender, System.EventArgs e)
{
this.ListBox1.Items.Add (this.TextBox1.Text);

}
}
Reply

Use magic Report

0

Threads

10

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-1-6 16:39:01
| Show all posts
Mainly set the event of the button:
private void Button1_Click (object sender, System.EventArgs e)
{
this.ListBox1.Items.Add (this.TextBox1.Text);

}
Reply

Use magic Report

1

Threads

60

Posts

37.00

Credits

Newbie

Rank: 1

Credits
37.00

 China

Post time: 2020-1-6 17:06:01
| Show all posts
private void Button1_Click (object sender, System.EventArgs e)
{
this.ListBox1.Items.Add (this.TextBox1.Text);

}

correct
Reply

Use magic Report

5

Threads

19

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

 Author| Post time: 2020-1-13 13:45:01
| Show all posts
The main thing is that when the listbox is running, it can't directly input data like the text box. ?
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