vb 框架设计
来源:互联网 发布:永川茶竹网软件 编辑:程序博客网 时间:2024/06/05 06:57
这2天一直在研究老系统,老系统是VB写的,就把老系统的框架写下把,就当是随笔了
首先 <!--#include virtual="/include/Common.aspx"--> '引用文件
<%@ Assembly Src="/code/EDI.vb"%>’程序集,可以使用edi.vb中的方法
<%@ Import Namespace="EDI"%>‘引用空间
‘声明全局变量
Dim FormColl As NameValueCollection ‘NameValueCollection 是一个集合,是个1对多的集合。他有点类似hashtable 但是hashtable是一个key 对于一个value.
NameValueCollection 一个key 可以对应多个value.
NameValueCollection 方法: Get 取出全部的值 eg: FormColl .get("key")
GetValues:取出一个值。 eg: FormColl .getvalues("key")
Set 指定一个值 。eg: theColl.Set("Lock_flag", "1")
Add:增加一个值。eg: theColl.Add("Lock_flag", "1")
Page_Load 进程。主要处理提交表单的时候数据是不是正确,Ispostback函数可以让程序更人性点。
Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim tmpResult As String = ""
Dim tmpEDIColl As NameValueCollection = New NameValueCollection
FormColl = New NameValueCollection
If IsPostBack = True Or Request.HttpMethod = "POST" Then
If GetForm(FormColl) = True Then
Dim EDIGeneratorObj As EDI.EDIGenerator
EDIGeneratorObj = New EDI.EDIGenerator(Core)
tmpResult = EDIGeneratorObj.GetEDI(FormColl.Get("edi_code"), tmpEDIColl)
If tmpResult <> "" Then
Session("WarningMessage") = tmpResult
Response.Redirect(Application("WarningPage"))
End If
tmpResult = EDIGeneratorObj.GenerateEDI(FormColl, tmpEDIColl.Get("Log_file"), CStr(Session("Operator_code")))
If tmpResult <> "" Then
Session("WarningMessage") = tmpResult
Response.Redirect(Application("WarningPage"))
End If
''Send successfully,then redirect to view edi log
Response.Redirect("/Working/Sharing/EDILogSelect.aspx" & _
"?id=" & Server.UrlEncode(tmpEDIColl.Get("Row_id")) & _
"&type=" & Server.UrlEncode(tmpEDIColl.Get("Bill_type")))
End If
Else
EDIConfigRecord = New EDI.EDIConfig(EDICode, Core)
tmpResult = SetForm(FormColl, CargoColl)
If tmpResult <> "" Then
Session("WarningMessage") = tmpResult
Response.Redirect(Application("WarningPage"))
Return
End If
'check page lock condition
If IsReadonly = True Then
ReadonlySign = " readonly=""readonly"" "
DisabledSign = " disabled=""disabled"" "
End If
End If
End Sub
GetForm 方法验证提交数据的正确性并格式化
SetForm 初始化数据。
Request.QueryString:页面url传值;
Request.Form 页面内表单数据传值;
Byref 传的是地址 Byval 传的是值
eg: ByRef theColl As NameValueCollection theColl 的值可以修改
eg:Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
- vb 框架设计
- VB基本框架
- VB Socket编程 框架
- VB设计动画时钟
- VB 报表设计
- vb+access设计
- vb报表的设计
- vb报表的设计
- 设计框架
- 框架设计
- 设计框架
- 设计一个vb循环语句
- VB设计培训信息管理系统
- 设计vb程序计算税率
- VB窗体弹出菜单设计
- VB.NET面向对象设计
- vb.net的UI设计
- 利用vb设计乘法运算
- MBTiles
- 分布式数据库架构--排序分页分组探讨
- 手把手教你玩转ARP包
- 2011-9-22 21:41:11
- netbeans 快捷键
- vb 框架设计
- Linux时间转化方法
- 深入理解critical_section
- 马氏距离
- 转:部分IT公司笔试算法题
- 无线网卡抓包
- apache2.2配置
- 如何使用VS2008內建的InstallShield
- 企业级任务调度框架Quartz一 --企业应用中的任务调度介绍