将标签中的文本与列表框中的一行相关联 [英] associating text in a label to a line in a listbox

查看:61
本文介绍了将标签中的文本与列表框中的一行相关联的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将标签中显示的数字与列表框中的一行相关联?

How do I associate the number displayed in a label with a line in a listbox?

例如:如果lblShowNumber.Text = 1,则列表框中的第一行= 1.

for example:  if lblShowNumber.Text=1 then the first line in a listbox = 1.

我知道第一行从0开始.

I know that the first line started at 0.

推荐答案

例如:如果lblShowNumber.Text = 1,则列表框中的第一行= 1.

for example:  if lblShowNumber.Text=1 then the first line in a listbox = 1.

不清楚列表框中的第一行= 1"是什么意思.如果要滚动列表框的内容,以使第1行位于显示的顶部,请使用TopIndex属性.  参阅:
https://msdn.microsoft.com /en-us/library/system.windows.forms.listbox.topindex(v=vs.110).aspx

It's not clear what you mean by "the first line in a listbox = 1".  If you mean to scroll the list box contents so that line 1 is at the top of the display, use the TopIndex property.   See:
https://msdn.microsoft.com/en-us/library/system.windows.forms.listbox.topindex(v=vs.110).aspx

如果您还有其他意思,请提供您正在尝试做的事情的详细说明.

If you mean something else, provide more description of what you are trying to do.

请注意,您不应使用标签文本来设置列表框的第一行.标签文本是通过某个变量设置的-该变量应用于列表框管理,而不是标签文本.

Please note that you should not use the label text to set the listbox first line.   That label text was set from some variable - that variable should be used for the listbox management instead of the label text.

https://msdn. microsoft.com/en-us/library/system.windows.forms.listbox.topindex(v=vs.110).aspx


这篇关于将标签中的文本与列表框中的一行相关联的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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