PDA

Click to See Complete Forum and Search --> : [RESOLVED] User input


Pasvorto
Sep 4th, 2007, 09:35 AM
This should be simple. I can create an situation where the user has to input data. No problem. However, I am having a problem figuring out how to do s imple message box with a yes/no button configuration. I can't find an example in any of my manuals.

VB6 code:

Dim PRINTREPLY As VbMsgBoxResult
PRINTREPLY = MsgBox("Print to screen?", vbYesNo)
If PRINTREPLY = vbNo Then
glbPrinterDestination = 1
Else
glbPrinterDestination = 0
End If

That is the kind of thing I am looking to do.

Pasvorto
Sep 4th, 2007, 10:01 AM
This seems to work:

Dim drClear As MsgBoxResult

drClear = MsgBox("Do you really want to clear the scans?", MsgBoxStyle.YesNo, "Clear scans confirmation")

If drClear = MsgBoxResult.Yes Then

Dim appFullPath As String = appPath '& appFile

System.IO.File.Delete(appFullPath)
Dim file As System.IO.FileStream
file = System.IO.File.Create(appFullPath)
file.Close()
objReader = New StreamReader(appFullPath)
objReader.Close()
MessageBox.Show("Scan file cleared")
End If

petevick
Sep 4th, 2007, 10:16 AM
Hi,
msgbox is retained for VB6 compatibility - take a look at Messagebox.Show instead

Pete