|
-
Feb 9th, 2010, 10:04 AM
#1
Thread Starter
Addicted Member
[RESOLVED] How to convert CDSAVE. in VB6
I have a legacy code using CDSave.diaglog, CDSave.title, CDSave.filename. How to convert to VB2008?
Thanks,
-
Feb 9th, 2010, 10:40 AM
#2
Re: How to convert CDSAVE. in VB6
We need a lot more information... What is that "CDSave" thing? Is it a form? What does CDSave.diaglog, CDSave.title and CDSave.filename do?
Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
- Abraham Lincoln -
-
Feb 9th, 2010, 10:47 AM
#3
Thread Starter
Addicted Member
Re: How to convert CDSAVE. in VB6
 Originally Posted by stanav
We need a lot more information... What is that "CDSave" thing? Is it a form? What does CDSave.diaglog, CDSave.title and CDSave.filename do?
The legacy code tried to open and save text into a file -
CDSave.Title = "Select Log File to Save As"
CDSave.ShowDialog()
On Error GoTo badfile
FileOpen(2, CDSave.FileName, OpenMode.Output)
...
But Vb2008.NET doesn't recognize CDSave. How to convert to the above into VB.net or change something to make the legacy code work?
Thanks,
-
Feb 9th, 2010, 10:47 AM
#4
Re: How to convert CDSAVE. in VB6
My guess is it is a CommonDialogControl from VB6 which encompased the "save" "open" type dialogs. You would use a SaveFileDialog control which you can find in the toolbox under the "dialogs" section. It works nearly the same way as VB6.
-
Feb 9th, 2010, 11:02 AM
#5
Thread Starter
Addicted Member
Re: How to convert CDSAVE. in VB6
 Originally Posted by kleinma
My guess is it is a CommonDialogControl from VB6 which encompased the "save" "open" type dialogs. You would use a SaveFileDialog control which you can find in the toolbox under the "dialogs" section. It works nearly the same way as VB6.
you points out the key point. Thank you very much.
-
Feb 9th, 2010, 11:02 AM
#6
Re: [RESOLVED] How to convert CDSAVE. in VB6
Use the SaveFileDialog class as Kleinma suggested. Something like this:
Code:
Using sfd As New SaveFileDialog()
With sfd
.Title = "Select Log File to Save As"
.Filter = "Text File (*.txt)|*.txt"
.OverwritePrompt = True
If .ShowDialog() = Windows.Forms.DialogResult.OK Then
System.IO.File.WriteAllText(.FileName, "the text to write to the file here")
End If
End With
End Using
Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
- Abraham Lincoln -
-
Feb 9th, 2010, 11:07 AM
#7
Thread Starter
Addicted Member
Re: [RESOLVED] How to convert CDSAVE. in VB6
 Originally Posted by stanav
Use the SaveFileDialog class as Kleinma suggested. Something like this:
Code:
Using sfd As New SaveFileDialog()
With sfd
.Title = "Select Log File to Save As"
.Filter = "Text File (*.txt)|*.txt"
.OverwritePrompt = True
If .ShowDialog() = Windows.Forms.DialogResult.OK Then
System.IO.File.WriteAllText(.FileName, "the text to write to the file here")
End If
End With
End Using
I appreicate it!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|