本文介绍了在DataGridView中切换文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在网上拖了好几个小时了.我要做的就是在Regular和StrikeOut之间的未绑定DataGridView的单元格中切换文本.我一直在尝试这一行代码(以及其他代码):-

Hi, I have been trawling the net for hours. All I want to do is toggle text in a cell in an unbound DataGridView between Regular and StrikeOut. I have been trying with this line of code (amongst others):-

"If DGV(2, 1).Style.Font.Style = FontStyle.Strikeout Then"



我得到的答案是''object reference not set to an instance of an object''.

请帮忙.
唐.



The answer I get is ''object reference not set to an instance of an object''.

Please help.
Don.

推荐答案

DGV(2, 1).Style.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Strikeout, System.Drawing.GraphicsUnit.Point, CType(0, Byte))


在快速监视中显示此值时,这里的DGV(2,1).Style.Font.Style无效.


Here DGV(2, 1).Style.Font.Style is nothing when you show this value in quick watch.



这篇关于在DataGridView中切换文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 16:43