开发者

How do I go about writing new controls in VB6?

开发者 https://www.devze.com 2023-01-27 08:44 出处:网络
I\'m looking to create controls based on text boxes that validate numeric fields and restrict them to certain ranges without having to write all the callbacks for each control on the form.

I'm looking to create controls based on text boxes that validate numeric fields and restrict them to certain ranges without having to write all the callbacks for each control on the form.

Does anyone know of a tutorial on how to create and use such things?

Or alternatively, as I can't be the first person to have this requirement, are the开发者_StackOverflow中文版re a set of such controls available for use anywhere?


The simplest way is to use control arrays. Google turned up this tutorial. You could encode the minimum/maximum range into the Tag property of each individual control, or you could use the Index to look them up from arrays.

You can create a user-defined control in VB6 but I'm not sure it's worthwhile for this task. You have to write a lot of boilerplate code.


I think you can use the default text box, using the Validate event, or alternatively, if you need "live" checking then you could check in the KeyPressed, Change, etc events.

0

精彩评论

暂无评论...
验证码 换一张
取 消