搜索
首页 电脑/网络 软件

vb编程 高手进

题目是这样的:在代码中自动加载一个标签的标题和文本框的文本,单击“修改”按钮后改变标签中的标题和文本框中的文本。急需,请高手帮忙!!!!

全部回答

2006-09-13

52 0

楼上的纯粹胡扯 手头没有VB,但记得应该是在Button_Click()事件中,设定Lable1.Text = "修改的字符串"就可以了

2006-09-12

75 0

    在一般的文书编辑软件中,例如 Windows 本身提供的记事本及小作家中,我们都可以在【编辑】下拉选单中,找到【查找】、【替换】二项功能,我想很多人自己在撰写编辑程序时,也都会自己写程序去模拟这二个相当基本的功能。
  其实根本不用您自己花时间去写这样的程序码! 还记得 Microsoft Common Dialog Control (16 位元文件是 Comdlg16。  ocx,32 位元文件是 Comdlg32。
  ocx) 吗?我们都知道,这个控制项可以帮助我们做到以下几件事情: 1、ShowOpen:打开文件 2、ShowSave:存文件 3、ShowPrinter:设定打印机 4、ShowFont:设定字型 5、ShowColor:设定颜色 6、ShowHelp:开启说明文件 当然,您若还想要 Microsoft Common Dialog Control 多做一些别的事也没办法的!但是,Microsoft 在提供 。
    ocx 文件的同时,还提供了另外一个文件,也就是 comdlg32。dll,它的功能就多了,除了上面提到的几种问话框之外,还有好几个不同功能的问话框,其中就包含【查找】、【替换】二项功能!这二个 API 分别是 FindText 及 ReplaceText 二个。
     在程序中,要声明这二个 API 之前,由於它们都会引用到一个名为 FINDREPLACE 的 Type,所以我们在声明 Function 之前,必须先声明 Type FINDREPLACE,程序码如下: 在表单的声明区中加入以下声明: 'Find/Replace Type Structure Private Type FINDREPLACE lStructSize As Long ' size of this struct 0x20 hwndOwner As Long ' handle to owner's window hInstance As Long ' instance handle of。
    EXE that contains cust。 dlg。 template flags As Long ' one or more of the FR_?? lpstrFindWhat As String ' ptr。
   to search string lpstrReplaceWith As String ' ptr。   to replace string wFindWhatLen As Integer ' size of find buffer wReplaceWithLen As Integer ' size of replace buffer lCustData As Long ' data passed to hook fn。
     lpfnHook As Long ' ptr。 to hook fn。 or NULL lpTemplateName As String ' custom template name End Type 'Common Dialog DLL Calls Private Declare Function FindText Lib "comdlg32。
    dll" Alias "FindTextA" (pFindreplace As FINDREPLACE) As Long Private Declare Function ReplaceText Lib "comdlg32。
  dll" Alias "ReplaceTextA" (pFindreplace As FINDREPLACE) As Long 'Delcaration of the type structure Dim frText As FINDREPLACE 在表单中加入二个 Command Button,并命名为 cmdFind, cmdReplace,加入以下程序码: Private Sub cmdFind_Click() 'Call the find text function FindText frText End Sub Private Sub cmdReplace_Click() 'Call the replace text function ReplaceText frText End Sub Private Sub Form_Load() 'Set the Find/Replace Type properties With frText 。
    lpstrReplaceWith = "Replace Text" 。lpstrFindWhat = "Find Text" 。wFindWhatLen = 9 。
  wReplaceWithLen = 12 。hInstance = App。hInstance 。  hwndOwner = Me。hWnd 。
    lStructSize = LenB(frText) End With End Sub 好了,您现在可以按 F5 试试了! 注:在 Type FINDREPLACE 中有一个 flag,您可以代入的 flag 是 FR_??,您可以在 API 检视员中找找!。

类似问题换一批

热点推荐

热度TOP

相关推荐
加载中...

热点搜索 换一换

电脑/网络
软件
程序设计
电脑装机
操作系统/系统故障
硬件
笔记本电脑
百度
互联网
反病毒
软件
软件
多媒体软件
系统软件
办公软件
网络软件
图像处理软件
举报
举报原因(必选):
取消确定举报