从列表框中选择项目的问题 [英] Problem with Selecting Items From a List Box

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

问题描述

您好


我正在尝试使用此处发布的代码
http://technet.microsoft.com/en-us/library/ff730949.aspx


问题是$ x什么都不返回(例如没有输出到控制台并显示为空)


但是,如果我更改以下行 


$ x = $ objListBox.SelectedItem



write-host $ objListBox.SelectedItem


它确实返回我选择的相关项目。


原始代码,如果我将最后一行更改为


$ X -eq $ null


它返回True


我需要将相关字符串值(例如项目选择)变为变量X以用于后者比较


请告知


非常感谢


Ernie

解决方案

这是正确的。你不能这样做。


试试这个:写主机


x



Hello

I am trying to use the code posted here http://technet.microsoft.com/en-us/library/ff730949.aspx

The problem is $x return nothing (e.g. return no output to the console and appears empty)

however if I change the following line 

$x=$objListBox.SelectedItem

to

write-host $objListBox.SelectedItem

it does return the relevent item I chose.

with the original code if I change the last line to

$X -eq $null

it returns True

I need to get the relevent string value (e.g. the item choosen) into variable X for latter comparision

Please advise

Thanks very much

Ernie

解决方案

That is correct. You cannot do that.

Try this: Write-Host


x


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

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