您现在的位置是: 软件 > 开发者网络 > 程序方舟 > 开发专栏 > VB开发 > 正文
·速成电脑精英(包分配)白领高薪一族从这里开始



-Java套接字编程(下)
-MediaStudio Pro 6.5教程
-三款卸载软件最新试用
-基于Visual C++的Winsock API研究

vb设计数据库电子邮件程序
2001-06-12· ·crystal编译··yesky

上一页  1 2 3 4 5 6  下一页

  ADODB Fields

  与其为ADODB作一个reference,不如通过objects来存取。此子程序将ComboBox作为一个变量参数,可以用来更新Database properties上的Field combo和Secondary Field Combo.。

  Fill Field Combo使用DNS 及 Table combo boxes提供的信息来打开表格。当型循环会扫描每个域名并将此添加到Field combo上。

Private Sub FillFieldCombo(myCombo As ComboBox)
'-- myCombo - the ComboBox that is to be updated by the subroutine
On Error GoTo DSNTablesError
'--Populate the field combo using ADODB

Dim oTempConnection As Object
Dim oTable As Object

Dim intCount As Integer
Dim intNumOfFields As Integer

Set oTempConnection = CreateObject("ADODB.Connection")
oTempConnection.Open PropertyForm.DSNCombo.Text, _
PropertyForm.UserNameText, PropertyForm.PasswordText
Set oTable = CreateObject("ADODB.RecordSet")
Set oTable.ActiveConnection = oTempConnection

oTable.Source = "SELECT * FROM " & PropertyForm.TableCombo
oTable.Open

intNumOfFields = oTable.Fields.Count
myCombo.Clear

While (intCount < intNumOfFields)
myCombo.AddItem oTable.Fields(intCount).Name
intCount = intCount + 1
Wend

oTable.Close
oTempConnection.Close
Exit Sub

DSNTablesError:
MsgBox "Invalid Table Name"
End Sub


  Outlook Objects

  FillFolderCombo和FillMailboxCombo 子程序非常类似。都是通过开启至OUTLOOK的连接以及增加combos来运作的。FillMailboxCombo:当用户登入另外的邮箱,则会被默认为是Outlook里的最上层文件夹;FillFolderCombo则是进入专门的邮箱的子文件夹并增加Folder combo。

Private Sub FillFolderCombo()
On Error GoTo Err_Folder
' 'Put the names of all available folders in the folderCombo

Dim myOlApp As Object
Dim olNamespace As Object
Dim iCount As Integer
Dim mystr As String


Set myOlApp = CreateObject("Outlook.Application")
Set olNamespace = myOlApp.GetNameSpace("MAPI")

iCount = 1
FolderCombo.Clear
mystr = MailboxCombo

While iCount <= olNamespace.folders(mystr).folders.Count
FolderCombo.AddItem olNamespace.folders(mystr).folders(iCount).Name
iCount = iCount + 1
Wend

Exit Sub
Err_Folder:
MsgBox "Unable to resolve mailbox"
End Sub



Private Sub FillMailboxCombo()
'--Fill in all the names of available mailboxes

Dim myOlApp As Object
Dim olNamespace As Object
Dim iCount As Integer

Set myOlApp = CreateObject("Outlook.Application")
Set olNamespace = myOlApp.GetNameSpace("MAPI")

iCount = 1
MailboxCombo.Clear
While iCount <= olNamespace.folders.Count
MailboxCombo.AddItem olNamespace.folders(iCount).Name
iCount = iCount + 1
Wend
End Sub

上一页  1 2 3 4 5 6  下一页

【责任编辑:方舟】
【发表评论】【关闭窗口】
■ 相关内容
 用VB创建复杂表格
 用VB6.0编写电脑抽奖程序
 在VB中存取数据库中的图片
 Oracle 9i产品文档
 利用Windows API获得系统高级功能
 谈谈Windows API 在VB 中的应用
 远程共享显示及声音的实现
 利用Winsock控件实现局域网通信
 利用VB提取HTML文件中的EMAIL地址
 用VB编写异步多线程下载程序
 VB6.0开发网络应用的5个技巧
感谢 访问天极网,如果您觉得该文章涉及版权问题,请看这里!