thanks because you has been come to this post. I have an error with my script, that log says:
Access to the path 'C:\Windows\system32\Com\dmp' is denied.
I want to set my application to windows startup, so when that computer client started, my software is automatically running. So i put this script on my Main Load.
private void Main_Load(object sender, EventArgs e)
{
//Menjadikan software ke dalam Startup Windows, sehingga dapat berjalan ketika pc pertama kali dinyalakan
RegistryKey reg = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
reg.SetValue("PR Reminder", Application.ExecutablePath.ToString());
listMapel();
bool notif = Properties.Settings.Default.Notification;
if (notif == true)
{
checkExpired(); //Mengecek tanggal penyerahan dan pemberian
}
The result is work. But I'm getting an error like this.
After explored more deeply, the center of the issue is the method listMapel(); where he was tasked to search for files ending in .db in the local directory.
I dont know why this method is got error. When i try to remove this method, my application running fine when startup. I think the problem is on system.io.
This is my listMapel(); method script
public void listMapel()
{
comboListMapel.Items.Clear();
string path = Directory.GetCurrentDirectory(); //Lokal direktori
string[] files = Directory.GetFiles(path, "*.db", SearchOption.AllDirectories);
foreach (string file in files)
{
nama = file.Split(".".ToCharArray()); //Hasil result yang ditampilkan Matapelajaran.db (Tapi dengan ini kita mengambil string sebelum .db
comboListMapel.Items.Add(Path.GetFileName(nama[0]));
}
}