列表框TextBoxes帮助 [英] Listbox TextBoxes Help

查看:75
本文介绍了列表框TextBoxes帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!



我创建了一个列表框和文本框。

列表框有Name,ProductNumber,Color等等但是它只显示名称。



当我从列表框中选择名称时,我希望它显示文本框中未显示的所有值。任何帮助将非常感谢。谢谢。



OP'从下面的评论中复制的附加信息

Hi!

I have created a Listbox and textboxes.
The Listbox has Name, ProductNumber, Color, and so on but it only shows the Name.

When I select The Name from the Listbox, I want it to display all the values that are not shown in textboxes. Any help would be very much appreciated. Thanks.

OP''s additional information copied from comment below

public void GetMyData(string prod)
{
   TextBox_ProdNum.Text = prod;

   TextBox_Color.Text = prod;
}

推荐答案

您好Kurac,请使用以下演示代码...

Hi Kurac,use following demo code...
public partial class Form1 : Form
  {
      private static string[] nameS;
      public Form1()
      {
          InitializeComponent();
          string name = "Shir Visnu Bhagwan";
          nameS = name.Split(' ');
          listBox1.Items.Add(nameS[0]);
        }

      private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
      {
          textBox1.Text = nameS[1];
          textBox2.Text = nameS[2];
      }
  }







再试一次..

快乐编码: - )


and just try once more..
Happy coding :-)


嗨亲爱的,



hi dear,

private void listBox1_SelectedValueChanged(object sender, EventArgs e)
        {
            // your selected value is store in textbox
            textBox1.Text = listBox1.SelectedItem.ToString();
        }


这篇关于列表框TextBoxes帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆