FileOpen Diag. @ VB.NET

  • Thread starter Thread starter William Cruz
  • Start date Start date
W

William Cruz

I am working with the openfile dialogue on VB.NET express. I want the
filename to appear on a label that I have on the main form when I click
on a file on the openfile dialogue. How can this be accomplished?
Example, I have the openfile diag. Displayed & in the background I have
my main form, If I single-click on a file in the openfile diag. I want
that same filename to be displayed on the main form. Thanks in advance
for your help.
 
William said:
I am working with the openfile dialogue on VB.NET express. I want the
filename to appear on a label that I have on the main form when I click
on a file on the openfile dialogue. How can this be accomplished?
Example, I have the openfile diag. Displayed & in the background I have
my main form, If I single-click on a file in the openfile diag. I want
that same filename to be displayed on the main form. Thanks in advance
for your help.

If OpenFileObject.ShowDialog = ShowDialog.Ok then
FileLabel.Text = OpenFileObject.Filename
End if
 
Ok, this is what I have, but it doesn't work. :(

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

If OPfile.ShowDialog = Windows.Forms.DialogResult.OK Then

FileLabel.Text = OPfile.FileName
End If

End Sub
End Class
 
I was wanting it to update automaticly when I single-click on the file.
Is this possible?

William Cruz
 
William said:
I was wanting it to update automaticly when I single-click on the file.
Is this possible?

William Cruz

How can they see your textfile when the dialog is shown? It could be
covering it. You'll have to make your own file dialog to get this to
work the way you want though.

Chris
 
I was planing on show the diag. box in a pre-determined location, not
over the main form. Is there a way to modify the openfilediag. provided
by vb.net?

William Cruz
 
I was planing on show the diag. box in a pre-determined location, not
over the main form. Is there a way to modify the openfilediag. provided
by vb.net?

Not impossible, however because you ask this style of question probably not
by you.
The answers given to build your own file dialog will probably than be the
best.

In fact are you building it by wanting the file name to be displayed in
another control in advance that the user has made his decission.

I hope this helps,

Cor
 
hi William,
it is possible to have the file name on the label as u select them
in "open file " dialog. this can be done through THREADING. create one
thread and using thread display the "open file" dialog. and check in
thread if the file selected or not. if selected then update the lable.
i'm not sure. it is just an idea. but if it works then label will be
update reapidly so ti may flicker. check it out yourself
 
Lucky said:
it is possible to have the file name on the label as u select them
in "open file " dialog. this can be done through THREADING. create one
thread and using thread display the "open file" dialog. and check in
thread if the file selected or not. if selected then update the lable.
i'm not sure. it is just an idea. but if it works then label will be
update reapidly so ti may flicker. check it out yourself

I believe it's possible with a Win32 dialog hook, but that's not that
easy...
 
Back
Top