load in external txt file

load in external txt file

Anonymous
Not applicable
365 Views
2 Replies
Message 1 of 3

load in external txt file

Anonymous
Not applicable
Hello,

I am new to .NET as well as the Revit API. I was looking to modify the AutoParameter sample so that the user could load in the parameters txt file instead of having it be in the family folder. Is there a sample that shows loading in a user selected file anywhere in the sample SDK code?

Thanks everyone,

aj
366 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Do you mean something like this?

private void button1_Click(object sender, EventArgs e)
{
System.Windows.Forms.OpenFileDialog fileSelector = new System.Windows.Forms.OpenFileDialog();
fileSelector.Filter = "Shared Parameters File (*.txt)|*.txt|All Files (*.*)|*.*";
fileSelector.Multiselect = false;
fileSelector.InitialDirectory = "C:\\";
string sSelectedFileName = string.Empty;

switch (fileSelector.ShowDialog())
{
case DialogResult.OK:
sSelectedFileName = fileSelector.FileName;
break;
default:
// Cancel button was clicked, dialog was closed with the X, etc.
break;
}

if (!string.IsNullOrEmpty(sSelectedFileName))
{
MessageBox.Show("The file name selected was: " + sSelectedFileName);
}
else
{
MessageBox.Show("No file was selected.");
}

}
0 Likes
Message 3 of 3

Anonymous
Not applicable
wow. great!

I will have to see if I have any luck integrating that into the AutoParameter example.

Thanks!

-
aj
0 Likes