用下面的代码做成一个简单的表格
Private Sub Form2_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
' データだけを貼り付け
Dim inputmap1 As FarPoint.Win.Spread.InputMap = FpSpread1.GetInputMap(InputMapMode.WhenAncestorOfFocused)
inputmap1.Put(New FarPoint.Win.Spread.Keystroke(Keys.V, Keys.Control), FarPoint.Win.Spread.SpreadActions.ClipboardPasteValues)
Dim inputmap2 As FarPoint.Win.Spread.InputMap = FpSpread1.GetInputMap(InputMapMode.WhenFocused)
inputmap2.Put(New FarPoint.Win.Spread.Keystroke(Keys.V, Keys.Control), FarPoint.Win.Spread.SpreadActions.ClipboardPasteValues)
Dim data As New DataTable
data.Columns.Add("一")
data.Columns.Add("二")
data.Columns.Add("")
data.Rows.Add("11", "22")
data.Rows.Add("11", "22")
data.Rows.Add("11", "22")
data.Rows.Add("11", "22")
data.Rows.Add("11", "22")
data.Rows.Add("11", "22")
data.Rows.Add("11", "22")
data.Rows.Add("11", "22")
data.Rows.Add("11", "22")
data.Rows.Add("11", "22")
data.Rows.Add("11", "22")
data.Rows.Add("11", "22")
data.Rows.Add("11", "22")
data.Rows.Add("11", "22")
data.Rows.Add("11", "22")
Me.FpSpread1_Sheet1.DataSource = data
Dim cmbocell As New FarPoint.Win.Spread.CellType.ComboBoxCellType()
cmbocell.Items = (New String() {"January", "February", "March", "April", "May", "June"})
FpSpread1_Sheet1.Columns(2).CellType = cmbocell
End Sub
其中第三列是ComboBox,先拷贝第一列的几行数据粘贴到第三列上,因为第一列的数据不在第三列的Items中,所以显示空白,但是再
拷贝这几个空白的CELL,粘贴到第二列上,发现是刚才粘贴到第三列的数据,这说明虽然第三列没有显示数据,但实际上里面的value已经
被赋予了Items中不存在的值,现在想要取到跟实际相符合的值的话,又不想去取第三列的cell的text,应该怎么办?或者说有没有什么属性
让ComboBox不接受Items 里没有的值? |
|