private void btnBrowseLocation_Click(object sender, EventArgs e)
{
FolderBrowserDialog folderDlg = new FolderBrowserDialog();
folderDlg.ShowNewFolderButton = true;
// Show the FolderBrowserDialog.
DialogResult result = folderDlg.ShowDialog();
if (result == DialogResult.OK)
{
txtSavingLocation.Text = folderDlg.SelectedPath;
Environment.SpecialFolder root = folderDlg.RootFolder;
}
btnCreate.Enabled = txtSavingLocation.Text != null ? true : false;
}
--------------------------------------------------------------
private void RailfallEntryOnNotepad(DataTable dtData, string pathRainfallFile)
{
if (dtData != null && dtData.Rows.Count > 0)
{
fullRailfallPathFile = Path.Combine(pathRainfallFile, "Rainfall.txt");
FileStream fsRainfall = new FileStream(fullRailfallPathFile, FileMode.Create, FileAccess.Write);
StreamWriter swRainfall = new StreamWriter(fsRainfall, Encoding.UTF8);
for (int iRowCount = 0; iRowCount < dtData.Rows.Count; iRowCount++)
{
StringBuilder sbStationDataEntry = new StringBuilder();
for (int iColCount = 0; iColCount < dtData.Columns.Count; iColCount++)
{
sbStationDataEntry.Append(Convert.ToString(dtData.Rows[iRowCount][iColCount]));
if (iColCount < dtData.Columns.Count - 1)
{
sbStationDataEntry.Append("\t\t");
}
}
swRainfall.WriteLine(sbStationDataEntry.ToString());
}
//swRainfall.Write("190770");
//swRainfall.Write("\t");
//swRainfall.Write("ABC");
//swRainfall.Write("\t");
//swRainfall.WriteLine("+1900 +07700 +0392");
//swRainfall.WriteLine(" -------- ---- 1 ---- 2 ----");
// CommonEntryPart(swRIBASIM, dtRIBASIM, lstStatioName, 2);
swRainfall.Flush();
swRainfall.Close();
fsRainfall.Dispose();
}
{
FolderBrowserDialog folderDlg = new FolderBrowserDialog();
folderDlg.ShowNewFolderButton = true;
// Show the FolderBrowserDialog.
DialogResult result = folderDlg.ShowDialog();
if (result == DialogResult.OK)
{
txtSavingLocation.Text = folderDlg.SelectedPath;
Environment.SpecialFolder root = folderDlg.RootFolder;
}
btnCreate.Enabled = txtSavingLocation.Text != null ? true : false;
}
--------------------------------------------------------------
private void RailfallEntryOnNotepad(DataTable dtData, string pathRainfallFile)
{
if (dtData != null && dtData.Rows.Count > 0)
{
fullRailfallPathFile = Path.Combine(pathRainfallFile, "Rainfall.txt");
FileStream fsRainfall = new FileStream(fullRailfallPathFile, FileMode.Create, FileAccess.Write);
StreamWriter swRainfall = new StreamWriter(fsRainfall, Encoding.UTF8);
for (int iRowCount = 0; iRowCount < dtData.Rows.Count; iRowCount++)
{
StringBuilder sbStationDataEntry = new StringBuilder();
for (int iColCount = 0; iColCount < dtData.Columns.Count; iColCount++)
{
sbStationDataEntry.Append(Convert.ToString(dtData.Rows[iRowCount][iColCount]));
if (iColCount < dtData.Columns.Count - 1)
{
sbStationDataEntry.Append("\t\t");
}
}
swRainfall.WriteLine(sbStationDataEntry.ToString());
}
//swRainfall.Write("190770");
//swRainfall.Write("\t");
//swRainfall.Write("ABC");
//swRainfall.Write("\t");
//swRainfall.WriteLine("+1900 +07700 +0392");
//swRainfall.WriteLine(" -------- ---- 1 ---- 2 ----");
// CommonEntryPart(swRIBASIM, dtRIBASIM, lstStatioName, 2);
swRainfall.Flush();
swRainfall.Close();
fsRainfall.Dispose();
}
No comments:
Post a Comment