如何在VB6中设置粘性变量>> [

问题描述 投票:1回答:1
我是Visual Basic 6的新手,没有机会升级到较新的平台。我们需要对现有程序进行一些更改。

我有一个带有3个文本框的表单(Form1)。用户填写它们后,我需要保存每个文本框值。

在用户按下Enter键之后,应保存该框的值,以后再测试单个功能/子菜单中的空值。

这是我到目前为止的内容:

Private Sub empId_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then Dim empId As String empId = Form1.empId.Text 'Save this for a later test End If End Sub Private Sub orderNo_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then Dim orderNo As String orderNo = Form1.orderNo.Text 'Save this for a later test End If End Sub Private Sub partNo_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then Dim partNo As String partNo = Form1.partNo.Text 'Save this for a later test End If End Sub

设置完所有变量后,我想做类似的事情:

if(!empId || !orderNo || !partNo) { // show error } else{ // process the data }

有人可以告诉我该怎么做吗?

我是Visual Basic 6的新手,没有机会升级到较新的平台。我们需要对现有程序进行一些更改。我有一个带有3个文本框的窗体(Form1)。我需要保存...

vb6
1个回答
2
投票
以下代码与您已经提供的代码相似,但是应该执行您需要的操作:
© www.soinside.com 2019 - 2024. All rights reserved.