עבור לתוכן
View in the app

A better way to browse. Learn more.

HWzone

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Winform בשפת C# - הגדרת כפתור ADD שבוחר קבצים חוזר תמיד לאותו ה-path

Featured Replies

פורסם

יש לי תוכנית עם GUI שבה יש כפתור ADD שפותח לי חלון שבו אני בוחר קבצים, איך מגדירים את זה ככה שהכפתור יזכור תמיד את ה-path האחרון שהוא היה בו ולא יחזור תמיד לתיקית default שלו ?

מה שיש לי עד עכשו זה רק: (פותח את החלון windows לבחירת הקבצים)

openFileDialog1.ShowDialog(); 

פורסם
  • מחבר

אוקיי תודה אנ אסתכל על זה ועוד משהו אחד, כרגע מתאפשר לי לבחור רק קובץ אחד ולא כמה בו זמנית, איפה אני מפעיל את האפשרות הזו ?

פורסם
  • מחבר

תודה רבה !

ועוד משהו שלא מצאתי הוא איך אני גורם לזה שאם בחרתי קובץ מסויים אז בפעם הבאה שהחלון יפתחת הוא יזכור את ה-path האחרון ולא יחזור לדיפולט

אני יודע שזה משהו עם

openFileDialog1.RestoreDirectory = true;

אבל לא ממש הצלחתי לזה לגרום לעבוד, אולי לא שמתי את זה במקום הנכון

פורסם

זה צריך להיות False...

אגב זה הברירת מחדל, אז מעניין מה קרה אצלך.

פורסם
  • מחבר

עדיין לא עובד, זה הקוד שלי:


private void btnAdd_Click(object sender, EventArgs e)
{
System.IO.Stream myStream;
OpenFileDialog thisDialog = new OpenFileDialog();


thisDialog.InitialDirectory = "d:\\";
thisDialog.Filter = "All files (*.*)|*.*"; // Set the file dialog to filter for all files
thisDialog.FilterIndex = 1;
thisDialog.RestoreDirectory = false;
thisDialog.Multiselect = true; // Allow the user to select multiple files
thisDialog.Title = "Please Select Source File(s) for Conversion";


if (thisDialog.ShowDialog() == DialogResult.OK)
{
foreach (String file in thisDialog.FileNames)
{
try
{
if ((myStream = thisDialog.OpenFile()) != null)
{
using (myStream)
{
listBoxCaptures.Items.Add(file);
}
}
}


catch (Exception ex)
{
MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message);
}
}
}
}

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.