2009-07-13 7 views
0

私はファイルを開き、内容をTextFieldに入れようとしていますが、Common Dialogを使用し、Visual Basic 6ではコマンドダイアログのみを使用しています。ファイルを開いてその内容を書き込む方法TextField?

これは、私はeVBの中に同じアプリケーションをやろうとしている、とeVBのは、これらのようなものをサポートしていないので、それはVB6の開発がより簡単になります:

Dim objFSO As New Scripting.FileSystemObject 
Dim objStream As Scripting.TextStream 
+0

「*のTextFieldの彼*内容を...と入れて...」:記事(すでにコモンダイアログから、あなたのファイル名(myFileName)を得たと仮定した場合)からサンプルコード?このボブ・ドールのファイルですか、あなたはテキスト・フィールドに彼のコンテンツを入れていますか? – nilamo

+0

性別差別!弁護士に電話する。 – MattC

+0

ジェンダー差別はなぜですか? –

答えて

1

チェックアウトeVB File Access through the WinCE API。 - コンテンツ

Public Const GENERIC_READ As Int32 = &H80000000 
Public Const OPEN_EXISTING As Int32 = 3 

' CreateFile will open a file handle (hFile) to the file in the myFileName variable 
hFile = CreateFile(myFileName, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0) 

lFileSize = GetFileSize(hFile, 0) 

' String(lFileSize, 0) will prepare the sContents string variable 
' to hold the contents of the file 
sContents = String(lFileSize, 0) 

' ReadFile actually reads the file we opened earlier and puts the contents 
' into the sContents variable 
ReadFile hFile, sContents, lFileSize, dwRead, 0 

' Put the contents we read into the textbox 
myTextBox.Text = sContents 
+1

Nathan、上記のコードサンプルにいくつかのコメントを追加しました。基本的に、開く必要があるファイル(myFileNameに保存されているファイル名/パス)を知ったら、4行のコードでデータ(CreateFile、GetFileSize、String、およびReadFile)を取得します。コードをコピーして、それを渦巻きにします。 –

+0

ありがとう非常に非常に!!!!!!!! –