Hello,
The script below populated a rich text box from a SQL file but I'd like it to keep the sql formatting, is this possible?
Private Sub OpenFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog1.FileOk
Dim strm As System.IO.Stream
strm = OpenFileDialog1.OpenFile()
txtOpenScript.Text = OpenFileDialog1.FileName.ToString()
If Not (strm Is Nothing) Then
strm.Close()
Dim FILE_NAME As String = txtOpenScript.Text
If System.IO.File.Exists(FILE_NAME) = True Then
Dim objReader As New System.IO.StreamReader(FILE_NAME)
txtScript.Text = objReader.ReadToEnd.Replace("###USERID###", "")
objReader.Close()
Else
MsgBox("File Does Not Exist")
End If
End If
End Sub
I also need to know how to open Management Studio and open a new query with the contents of the RTB?
Thanks
The script below populated a rich text box from a SQL file but I'd like it to keep the sql formatting, is this possible?
Private Sub OpenFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog1.FileOk
Dim strm As System.IO.Stream
strm = OpenFileDialog1.OpenFile()
txtOpenScript.Text = OpenFileDialog1.FileName.ToString()
If Not (strm Is Nothing) Then
strm.Close()
Dim FILE_NAME As String = txtOpenScript.Text
If System.IO.File.Exists(FILE_NAME) = True Then
Dim objReader As New System.IO.StreamReader(FILE_NAME)
txtScript.Text = objReader.ReadToEnd.Replace("###USERID###", "")
objReader.Close()
Else
MsgBox("File Does Not Exist")
End If
End If
End Sub
I also need to know how to open Management Studio and open a new query with the contents of the RTB?
Thanks