I am using this code to to generate a crystal report from aa sql string that i construct using a supplied table name and some column names in txtSQL.This code contains functionality to export to ms word.However when the save dialog comes up and the user enters the intended filename.and saves the document.when the user attempts to open the document they have to use"open with" because the save dialog does not add an extension to the file so my question is how can i add an extension for tthe user programmatically.This is my first time using save dialog

Dim rpt As New MembersReport()
            sfdSaveMe.ShowDialog()
            Dim strExportFile As String = sfdSaveMe.FileName

            Dim sql_personnel As String = procesSQL(txtSQL.Text, cmbTableName.Text)
            Dim dt As New DataTable
            dt = MyFormz.cl_Class.SelectRows_B(sql_personnel, "CMS2010051005")

            ReportTitle = rpt.ReportDefinition.Sections(0).ReportObjects("txtReportTitle")
            ReportTitle.Text = strTitle

            rpt.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile
            rpt.ExportOptions.ExportFormatType = ExportFormatType.WordForWindows
            Dim objOptions As DiskFileDestinationOptions = New DiskFileDestinationOptions()
            objOptions.DiskFileName = strExportFile
            rpt.ExportOptions.DestinationOptions = objOptions

            rpt.SetDataSource(dt)
            rpt.Export()
            CrystalReportViewer1.ReportSource = rpt
            objOptions = Nothing
            rpt = Nothing
sfdSaveMe.Filter = "Word File | *.doc"

add the above code before the sfdSaveMe.ShowDialog()

To add a filter, you would simply do this:

sfdSaveMe.Filter = "MS Word (*.doc)|*.doc|All files (*.*)|*.*"

The string is comprised of the following:
Desscription|extention|

then to add more you just keep adding more.
Desscription1|extention1|Desscription2|extention2|Desscription3|extention3|

thanx dude

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.