Hi, Can someone give me some assistance with the dialog box, I want to be able to select multiple files at once , instead of one file at a time, How do I go by doing that.
the code snippet that i have so far below
public OpenFileDialog Cif_OpenDialogBox(OpenFileDialog openFileDialog1)
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
Stream myStream;
if ((myStream = openFileDialog1.OpenFile()) != null)
{
// Insert code to read the stream here.
Console.WriteLine(openFileDialog1.FileName);
myStream.Close();
}
}
return openFileDialog1;
}
public SaveFileDialog Cif_SaveDialogBox(SaveFileDialog saveFileDialog1)
{
saveFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
saveFileDialog1.FilterIndex = 2;
saveFileDialog1.RestoreDirectory = true;
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
Stream myStream;
if ((myStream = saveFileDialog1.OpenFile()) != null)
{
// Insert code to read the stream here.
//saveFileDialog1.FileName = textBox1.Text;
Console.WriteLine(saveFileDialog1.FileName);
myStream.Close();
}
}
return saveFileDialog1;
}
Loading
David SmithPosted Mar 17, 2010, 1:53 AM
which is below
openFileDialog1.Multiselect = true;
but im one issue, what im trying to do it is extract from a list of textfiles and send to my mdf database all at once, when I select all its not sending but one text file.
do you have any reason why.
this is what im doing below
while (!srReader.EndOfStream)
{
AccessToCcaFunctions.CreateInvalidDateTime();
sLine = srReader.ReadLine();
if (sLine == "1234")
{
sLine = srReader.ReadLine();
uiNumberOfLines = AccessToCcaFunctions.ConvertString2UnsigedInteger(sLine);
for (int i = 0; i < (uiNumberOfLines - 1) / 4; ++i)
{
for (int j = 0; j < 4; ++j)
{
sLine = srReader.ReadLine();
if (j == 0)
{
sError = AccessToCcaFunctions.GetError(sLine);
}
else if (j == 1)
{
sStamp1 = AccessToCcaFunctions.GetStamp1(sLine);
}
else if (j == 2)
{
Stamp2 = AccessToCcaFunctions.GetStamp2(sLine);
}
else if (j == 3)
{
sDatavalue = AccessToCcaFunctions.GetDataValue(sLine);
}
}
AccessToCcaFunctions.FilterFcodes(sError);
AccessToCcaFunctions.FilterECodes(
sError);AccessToCcaFunctions.FilterA_through_DCodes(
sError);AccessToCcaFunctions.Filter0_Through_9Codes(
sError);
}
//Checksum
sLine = srReader.ReadLine();
}
}
srReader.Close();
}
below is where i set up a function to open the dialog box and choose text files to extract from
**************************************
public OpenFileDialog Cif_OpenDialogBox(OpenFileDialog openFileDialog1)
{
openFileDialog1.Title = " Choose raw data files to extract!";
openFileDialog1.Multiselect = true;
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
Stream myStream;
if ((myStream = openFileDialog1.OpenFile()) != null)
{
// Insert code to read the stream here.
Console.WriteLine(openFileDialog1.FileName);
myStream.Close();
}
}
return openFileDialog1;
}