动态控制数据库 [英] Controls from database dynamically

查看:67
本文介绍了动态控制数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友们,



在我的项目中,我想显示数据库中的控件。让我解释这个概念,任何人都可以指导我如何编写代码。



例如,



在我的表格中有列,例如,



1. Label_Name 2. Control_Name 3. Maximum_Length 4. Mandatory_Status



每次打开表单时,控件都应根据表格详细信息生成。



例如,



如果表中的字段是这样的,



Label_Name:测试



控制:文本框



Maximum_Length:20



Mandatory_Status:Y



然后在我加载表单时,表单应包含,



标签名称为Test对应的控件为Textbox,它应该只允许20个字段,应该是强制字段。类似地,无论具有该表的数据应该生成什么。



我如何才能完成这项任务。任何人都可以指导我弄清楚这段代码。



提前致谢。>

Dear Friends,

In my project i want to display the controls from database. Let me explain the concept can anyone please guide me how to write the code for that.

For example,

In my table am having columns like,

1. Label_Name 2. Control_Name 3. Maximum_Length 4. Mandatory_Status

At every time while am opening the form, controls should generate based on the table details.

Example,

If Fields in tables are like,

Label_Name : Test

Control : Textbox

Maximum_Length :20

Mandatory_Status :Y

Then while i loading the form, form should contains,

Label name as "Test" corresponding control as "Textbox" and it should allow only 20 fields and it should be a mandatory one. Similarly whatever the datas the table having that should generate.

How can i achieve this task. can anyone please guide me to figure out this code.

Thanks in advance.>

推荐答案

您好,



在开始编写代码之前,请务必集中以下算法:



1.多少例如,需要控制类型TetxBox,Label,DropDown,CheckBox等...

2.为每个控件创建组件

  • 2.1 :Apply验证每个控件你想要什么,例如必需,数字,AlphaNumeric ......
  • 2.2 :发布你的组件(用于项目中的拖放)
Hello,

Do following algorithm you have to concentrate before starting write code:

1. How many types of control would be required e.g. TetxBox, Label, DropDown, CheckBox etc...
2. Created Component for each control
  • 2.1: Apply validation on each control whatever you would like e.g Required, Numeric, AlphaNumeric...
  • 2.2: Publish you component (for drag and drop in your project)
  • 4.1 :识别当前记录控制类型并相应地添加组件(您已创建)。
  • 4.2 :增加x和y位置用于下一个控件。
  • 4.3 :重复步骤4,直到获取所有记录。
  • 4.1: Identify current records Control type and accordingly add component (that you have created).
  • 4.2: Increase x and y position for the next control.
  • 4.3: Repeat step 4 until all records has been fetched.


这篇关于动态控制数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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