Русские Блоги
Введение в программирование на C #, применение элементов управления C # (textBox, checkBox, listBox, listView и т. Д.)
Откройте Visual Stdio для программирования
1. Применение элемента управления textBox:
Напишите код для окна входа в систему:
2. Применение элемента управления checkBox (флажок), дополните код этой картинки
Добавьте код в отображаемую кнопку личного хобби:
private void button1_Click(object sender, EventArgs e)
<
// Добавляем код в событие показа личной кнопки хобби
if (textBox1.Text == "")
<
MessageBox.Show (это, «Пожалуйста, введите свое имя», «Сообщение», MessageBoxButtons.OK, MessageBoxIcon.Information);
>
else
<
if (checkBox1.Checked == true && checkBox2.Checked == true)
textBox2.Text = textBox1.Text + «Нравится» + checkBox1.Text + »и« + checkBox2.Text;
else if (checkBox1.Checked == true && checkBox2.Checked == false)
textBox2.Text = textBox1.Text + «Нравится» + checkBox1.Text;
else if (checkBox1.Checked == false && checkBox2.Checked == true)
textBox2.Text = textBox1.Text + «Нравится» + checkBox2.Text;
else if (checkBox1.Checked == false && checkBox2.Checked == false)
textBox2.Text = "";
>
>
3. Приложение элемента управления listView, вытащите элемент управления listView, установите свойства:
Атрибут представления — DeTails
Открытые столбцы для добавления элементов данных в элемент управления listView
Результаты следующие: добавьте обработчики событий для кнопок добавления и удаления соответственно.
Thread: ListBox vs TextBox question
New Member
Join Date May 2009 Posts 2
ListBox vs TextBox question
I’m currently pulling in records from a text file into a textbox control (see code below). I want to get more control over this by adding multiple columns and want the ability to select 1 line or multi-line and "delete selected". I believe this should then be a listbox but can’t figure out how to convert my code to work with a list box. Any suggestions/ideas out there?
- View Profile
- View Forum Posts
PowerPoster
Join Date Nov 2008 Location UK Posts 3,327
Re: ListBox vs TextBox question
- View Profile
- View Forum Posts
- Visit Homepage
Super Moderator
Join Date May 2005 Location Sydney, Australia Posts 109,426
Re: ListBox vs TextBox question
- View Profile
- View Forum Posts
New Member
Join Date May 2009 Posts 2
Re: ListBox vs TextBox question
It says a listview is used to display a list of icons and It looks like almost horizontal columns. I want to list like a spreadsheet with a number in the first column (auto generated) and then a list of domain names (with extension) that I input in from file and then maybe the same list in the next column (without extensions). How will the listview accommodate this?
- View Profile
- View Forum Posts
- Visit Homepage
Super Moderator
Join Date May 2005 Location Sydney, Australia Posts 109,426
Re: ListBox vs TextBox question
- Site Areas
- Forums
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
is On are On code is On code is On
- HTML code is Off
Click Here to Expand Forum to Full Width
Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.
Список цифр в textBox или listBox
Пишу небольшую прогу. Смысл ее такой: есть textBox, в который я вствляю в столбик цифры: целые и с плавающей точкой. И нужно посчитать их сумму. Перебираю цифры с помощью for. Все бы ничего, но я так и не смог реализовать это. Какие-то цифры космические выбивал. В итоге пришлось это делать через listBox. Все получилось. Но тут есть неудобность: добавить в listBox цифры вручную, насколько я понял, нельзя.
Подскажите пожалуста, как такое же на textBox сделать. И правильно ли будет?
Textbox c и listbox в чем разница
Как добавить слово из textBox в listBox?
Текст из textbox добавить в ListBox
Текст из textbox Не могли бы Вы (форумчане) помочь: как из textbox достать текст которыйы ты.
textbox и listbox в с#. Помогите разобраться со взаимодействием
namespace lab5
public partial class Form1 : Form
List articles = new List ();
namespace lab5
public partial class Form1 : Form
List articles = new List ();
class Article public Article(string a, string t, string c) autor = a; title = t; contents = c;
>
public string autor;
public string title;
public string contents;
>
Введение в программирование на C #, применение элементов управления C # (textBox, checkBox, listBox, listView и т. Д.)
if (checkBox1.Checked == true && checkBox2.Checked == true)
textBox2.Text = textBox1.Text + «Нравится» + checkBox1.Text + »и« + checkBox2.Text;
else if (checkBox1.Checked == true && checkBox2.Checked == false)
textBox2.Text = textBox1.Text + «Нравится» + checkBox1.Text;
else if (checkBox1.Checked == false && checkBox2.Checked == true)
textBox2.Text = textBox1.Text + «Нравится» + checkBox2.Text;
else if (checkBox1.Checked == false && checkBox2.Checked == false)
textBox2.Text = «»;
>
>