如何在 VB6 中重新初始化 UDT? [英] How do I reinitialise a UDT in VB6?

查看:27
本文介绍了如何在 VB6 中重新初始化 UDT?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个循环,它读取一堆 XML 文件,对于每个文件,它验证 XML 中的数据并将其加载到一些 UDT 中,然后对数据进行一些工作.

I've got a loop, which is reading in a stack of XML files, for each one, it validates the data that was in the XML and loads it into some UDTs and then does some work on the data.

然后它回到循环的开头,UDT 仍然有来自前一个 XML 的数据.如果该标签在新标签中定义,它会覆盖,但如果该标签未定义,则 UDT 中的该元素将被保留.

Then it gets back to the beginning of the loop and the UDTs still have data in from the previous XML. If that tag is defined in the new one, it overwrites, but if that tag isn't defined, then that element in the UDT is left alone.

但我无法通过我用于变量的技术 (Let X = 0) 重置 UDT,除非我遍历 UDT 的每个元素并重置值.并且以对象样式(Set X as New UDT)执行此操作不起作用.

But I can't reset the UDT by the technique I'd use for a variable (Let X = 0) unless I go through every single element of the UDT and reset the value. And doing it object-style (Set X as New UDT) doesn't work.

我该怎么做?

推荐答案

将一个新变量设为 UDT,并将旧变量设置为新变量.

Dim a new variable as the UDT and set the old one equal to the new variable.

例如:

Dim XEmpty as UDT
X = XEmpty

将重新初始化 UDT 类型的 UDT 变量 X.

Will reinitialise a variable X that is a UDT of type UDT.

这篇关于如何在 VB6 中重新初始化 UDT?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆