VB6相關資源

2021-08-26 13:46:13 字數 2014 閱讀 9778

也許,又要撿起vb6了,做維護!複習一下!

1,基礎

常用快捷鍵:

f4:檢視物件的屬性

f5:開始執行、除錯

f8:單步除錯

f7:進入**模式

home:定位到當前**行的行首

end:定位到當前**行的行末

shift + f7:進入設計模式

shift + f2: 檢視某函式/變數的定義

shift + f3:查詢前乙個

shift + f10:檢視快捷鍵選單

ctrl + home:定位到**開頭

ctrl + end:定位到**結尾

ctrl + shift + f9:刪除所有斷點

ctrl + f5:全編譯執行

左下角有2按鈕:分別是檢視某乙個過程檢視、全模組檢視

**實現窗體的對齊方式:

form1.top = (screen.height - form1.height) / 2 』垂直居中

form1.left = (screen.width - form1.width) / 2 』 水平居中

顯示窗體:form1.show

顯示模式窗體:form1.show 1 或者 form1.show vbmodal

關閉窗體:unload form1

隱藏窗體:form1.hide

示例使用err物件的helpcontext屬性來顯示用於overflow錯誤

dim msg

err.clear

on error resume next

err.raise 6 'generate overflow error

if err.number <>0 then

msg="press f1 or help to see " & err.helpfile & _

" topic for " & _

" the following helpcontext: " & err.helpcontext

msgbox msg,,"error: " & err.description, _

err.helpfile,err.helpcontext

end if

變數名var1%=23 』表示var1是乙個整型變數

var2!=23 '表示var2是乙個單精度變數

var3#=23 '表示var3是乙個雙精度變數

dim student_name,student_home,student_age as string * 20 表示這些變數都是string型,且長度都為20

% 整型

! 單精度型

# 雙精度型

$ 字串型

& 長整型

@ 貨幣型別

為避免寫錯變數名,可以在類模組、窗體模組、標準模組的宣告斷中寫: option explicit

tools選單-->選項--> 編輯器-->要求宣告變數 勾中,這樣會在任何新建的模組中自動插入 option explicit,注意已存在的模組中不會自動插入,需要手工新增進去

模組級變數:private itemp as integer 只對當前模組有效,它與 dim itemp as integer表示意義一樣,但前者可讀性更強;

public itemp as integer 在其它模組中也有效

注意:只能在模組的宣告斷中用private 或 public ;在過程中只能用 dim

在過程中宣告的變數,是過程級變數,一般也叫區域性變數;

還有一種區域性變數:靜態變數,在過程中宣告,它使用之後,尚儲存值!用法:static ipermanent as integer

除錯輸出內容:debug.print "aaa"

變數型別:byte,boolean,integer,long,currency,decimal,single,date,string,object, variant等

編 程 入 門 --看例項學vb 6.0--vb的簡單語法學習

通過各種例項來學習vb6.0

2,例項

Solaris 10 相關資源

solaris 10 相關資源 1.獲取solaris 10 x86安裝光碟 2.solaris 10 安裝指南 llguide solaris.pdf 3.安裝過程中相關問題的解決 4.multi booting solaris and other operating systems 分割槽不懂的...

VB6技巧 總結

vb設定多行textbox的位置 由於自動輸入的文字比較多,最後輸入的跑到下面了,想要自動滾動到下面,本來以為 操作滾動條呢,但是沒有方法。於是我巧妙的採用了 顯示列表是設定了乙個多行 的 textbox 顯示列表.selstart len 顯示列表.text 1 顯示列表.sellength 1 ...

vb6 讀寫檔案

write file dim nhandle as integer,fname as string fname d 1.txt nhandle freefile open fname for output as nhandle print nhandle,0 print nhandle,2 clos...