RADIOBUTTON PARA PROCURAR BANCO DE DADOS

MARCOSSFERREIRA 30/06/2011 11:05:03
#378130
Bom pessoal, tenho um formulario que neste encontra-se um rabiobutton e quando clico nele eu consigo buscar qual planilha utilizar como banco de dados e faço aperecer o caminho em uma textbox.text, porem agora preciso criar outro radiobutton so que neste eu preciso selecionar diretamente em uma pasta que estará fixa no D: e ele nao deve dar a opcao de mudar o arquivo é simplismente ao clicar nele ja define direto qual planilha utilizar. Da forma que ta hoje eu uso o seguinte comando:

Dim TextoAntigo As String
OpenFileDialog1.Filter = [Ô]Planilhas|;*.ods[Ô]
OpenFileDialog1.FileName = [Ô][Ô]
OpenFileDialog1.ShowDialog()
If OpenFileDialog1.FileName = [Ô][Ô] Then
Exit Sub
Else
NomeArquivo = OpenFileDialog1.FileName
Try
ReDim objArg(1)
objArg(0) = MakePropertyValue([Ô][Ô], 0)
objArg(1) = MakePropertyValue([Ô]Hidden[Ô], True)
txtNomeArquivo.Text = [Ô]File:///[Ô] & NomeArquivo
TextoAntigo = txtNomeArquivo.Text
TextoNovo = TextoAntigo.Replace([Ô]\[Ô], [Ô]/[Ô])
ObjdocumentLV = objDesktop.loadcomponentfromURL(TextoNovo, [Ô]_Blank[Ô], 0, objArg)
Catch
MsgBox([Ô]Erro ao Abrir Arquivo[Ô])
End Try
ObjdocumentLV.Close(True)
ObjdocumentLV = Nothing
End If
PEGUDO 30/06/2011 12:39:08
#378136
Resposta escolhida
Tenta usar da forma abaixo
PS: Espero que te ajude porque fiz no olhômetro. Tô sem O Visual Studio aqui, agora.

        Dim LocalFixo As String = [txt-color=#e80000][Ô][Ô][/txt-color]
Dim TextoAntigo As String

If RadioButtonLocalFixo.Checked = True then LocalFixo = [txt-color=#e80000][Ô]D:/Sua_Pasta/PlanilhaODS.ods[Ô][/txt-color] [txt-color=#007100][ô]Aqui é o RadioButton[/txt-color]

If LocalFixo = [txt-color=#e80000][Ô][Ô][/txt-color] Then
With OpenFileDialog1
.Filter = [txt-color=#e80000][Ô]Planilhas (*.ods)|*.ods[Ô][/txt-color]
.FileName = [txt-color=#e80000][Ô][Ô][/txt-color]

If .ShowDialog = Windows.Forms.DialogResult.Ok then
NomeArquivo = OpenFileDialog1.FileName
Try
ReDim objArg(1)
objArg(0) = MakePropertyValue([txt-color=#e80000][Ô][Ô][/txt-color], 0)
objArg(1) = MakePropertyValue([txt-color=#e80000][Ô]Hidden[Ô][/txt-color], True)
txtNomeArquivo.Text = [txt-color=#e80000][Ô]File:///[Ô][/txt-color] & NomeArquivo
TextoAntigo = txtNomeArquivo.Text
TextoNovo = TextoAntigo.Replace([txt-color=#e80000][Ô]\[Ô][/txt-color], [txt-color=#e80000][Ô]/[Ô][/txt-color])
ObjdocumentLV = objDesktop.loadcomponentfromURL(TextoNovo, [txt-color=#e80000][Ô]_Blank[Ô][/txt-color], 0, objArg)
Catch
MsgBox([txt-color=#e80000][Ô]Erro ao Abrir Arquivo[Ô][/txt-color])
End Try
ObjdocumentLV.Close(True)
ObjdocumentLV = [txt-color=#0000f0]Nothing[/txt-color]
End If
End With
Else
Try
ReDim objArg(1)
objArg(0) = MakePropertyValue([txt-color=#e80000][Ô][Ô][/txt-color], 0)
objArg(1) = MakePropertyValue([txt-color=#e80000][Ô]Hidden[Ô][/txt-color], True)
txtNomeArquivo.Text = [txt-color=#e80000][Ô]File:///[Ô][/txt-color] & LocalFixo [txt-color=#007100]◄◄◄◄Aqui é onde você usaria o local fixo no D:/[/txt-color]
TextoAntigo = txtNomeArquivo.Text
TextoNovo = TextoAntigo.Replace([txt-color=#e80000][Ô]\[Ô][/txt-color], [txt-color=#e80000][Ô]/[Ô][/txt-color])
ObjdocumentLV = objDesktop.loadcomponentfromURL(TextoNovo,[txt-color=#e80000] [Ô]_Blank[Ô][/txt-color], 0, objArg)
Catch
MsgBox([txt-color=#e80000][Ô]Erro ao Abrir Arquivo[Ô][/txt-color])
End Try
ObjdocumentLV.Close(True)
ObjdocumentLV = [txt-color=#0000f0]Nothing[/txt-color]
End If
MARCOSSFERREIRA 30/06/2011 13:19:56
#378138
Execelente, não sei o que seria de mim sem este forum. Vocês são ótimos.
Obrigado mesmo.
Tópico encerrado , respostas não são mais permitidas