【发布时间】:2011-07-29 11:00:52
【问题描述】:
如果我说:
variableName = namecombobox.selectedItem
或
Dim variablename as type = namecombobox.SelectedIndex
Visual Studio 给了我错误
Option Strict 不允许从对象到字符串的转换。
我可以通过以下方式解决这个问题:
variableName = convert.ToString(namecombobox.SelectedItem)
组合框中包含的所有值是否自动视为非字符串,即使它们是字符串值(在本例中为“男性”和“女性”),以及将组合框中选定的值分配给的正确方法是什么?变量?
【问题讨论】: