VBGood网站全文搜索 Google

搜索VBGood全站网页(全文搜索)
首页 - 经验之谈 - vb设计数据库电子邮件程序(4)
发表评论(0)作者:不详, 平台:VB6.0+Win98, 阅读:7852, 日期:2001-06-14
vb设计数据库电子邮件程序
crystal编译--------------------------------------------------------------------------------




  修改和获得注册表设置

  下面是Property form和Apply button注释:s on-click的部份代码。

注释:-- Property form load event
注释:-- Load all registry settings
DSNCombo = GetSetting("EmailMaker", "Database", "DSN", "OLE_DB_NWind_Jet")
TableCombo = GetSetting("EmailMaker", "Database", "Table", "Customers")
FieldCombo.Text = GetSetting("EmailMaker", "Database", "Field", "ContactName")
UserNameText = GetSetting("EmailMaker", "Database", "User Name", "")
PasswordText = GetSetting("EmailMaker", "Database", "Password", "")
MailboxCombo = GetSetting("EmailMaker", "Mailbox", "Mailbox", "Mailbox - NorthWind")
FolderCombo = GetSetting("EmailMaker", "Mailbox", "Folder", "Drafts")
FromText = GetSetting("EmailMaker", "Mailbox", "From", "NorthWind")
SecondaryOption = GetSetting("EmailMaker", "Secondary", "On", 0)
SecondFieldCombo.Text = GetSetting("EmailMaker", "Secondary", "Field", "")

注释:-- Apply button注释:s OnClick event
Private Sub cmdApply_Click()
注释:-- Save all settings to registry

SaveSetting "EmailMaker", "Database", "DSN", DSNCombo.Text
SaveSetting "EmailMaker", "Database", "Table", TableCombo.Text
SaveSetting "EmailMaker", "Database", "Field", FieldCombo.Text
SaveSetting "EmailMaker", "Database", "User Name", UserNameText
SaveSetting "EmailMaker", "Database", "Password", PasswordText
SaveSetting "EmailMaker", "Mailbox", "Mailbox", MailboxCombo
SaveSetting "EmailMaker", "Mailbox", "Folder", FolderCombo
SaveSetting "EmailMaker", "Mailbox", "From", FromText
SaveSetting "EmailMaker", "Secondary", "On", SecondaryOption
SaveSetting "EmailMaker", "Secondary", "Field", SecondFieldCombo.Text

注释:-- Reinitialize the main form
MDIMain.Initialize

注释:-- Disable the Apply button
cmdApply.Enabled = False
End Sub


  当用户选择了数据库,程序就会使用RDO指令来专门化数据库以验证它们的table:然后,增加应用程序的table combo box,通过此,用户可以选择适当的table。最后,通过适当的table,ADODB指令会寻找到table的Field以便在"Fields" combo box上增加适当的域名。