我正在开发一个简单的VB.Net Windows窗体应用程序,我在其中填写表单,并将结果打印到打印机或保存PDF。我遇到问题的一个部分是如何在多次打印表单时清除以前的组合框选择。
例如,在表单上我有6个不同的选项,用户可以选择: 假期,医疗,公司业务,个人业务,牙科和其他。当我运行我的程序,并选择“假期”并预览表格时,选择“假期”。但是,当我关闭预览窗口并进行另一个选择时,“医疗”并预览表单现在都会显示两个选项。如果我在不关闭整个应用程序的情况下重复该过程,则将选择所有项目。有没有办法通过事件或修改我的逻辑来清除以前的选择?感谢
//this is short hand not actual code please
var = trainNum = 0;
// on button click
trainNum++;
// I can't figure out the format to put in so that firebase treats trainNum as the variable and not a string.
database.ref(Trains/**I WANT THIS TO EQUAL THE trainNum as it increments **).push({
});
//Train number is being stored in database I don't know if this will effect outcome.
我想知道,我应该在我的Print方法中调用此方法吗?我正在研究它的外观。这是我的Print方法:
Private Sub UltraTextEditor12_SelectionChanged(sender As Object, e As EventArgs) Handles UltraTextEditor12.SelectionChanged
Dim Counter As Integer = 10
For a As Integer = 0 To 6
If Me.UltraTextEditor12.SelectedIndex = a Then
C1Report1.Fields("Field" & Counter).Text = "XX"
End If
Counter += 1
Next
End Sub
答案 0 :(得分:1)
到目前为止,在使用我的代码之后,我能够找到解决方案。我最终实现的是一条清除了之前选择的线。这可能无法解决为什么以前的选择被保存的基础问题的底部,但我肯定解决了我的问题。我将不正确的代码留作注释:
Dim Counter As Integer = 10
'For a As Integer = 0 To 6
' If Me.UltraTextEditor12.SelectedIndex = a Then
' C1Report1.Fields("Field" & Counter).Text = "XX"
' End If
' Counter += 1
'Next
For a As Integer = 0 To 5
C1Report1.Fields("Field" & Counter).Text = ""
If Me.UltraTextEditor12.SelectedIndex = a Then
C1Report1.Fields("Field" & Counter).Text = "XX"
End If
Counter += 1
Next
End Sub