from comtypes.client import CreateObject
from comtypes.gen import IWshRuntimeLibrary
shell = CreateObject("WScript.Shell")
shortcut = shell.CreateShortCut(path).QueryInterface(IWshRuntimeLibrary.IWshShortcut)
shortcut.TargetPath = "C:\file.exe"
args = ["C:\folder\file.ext", argument]
shortcut.Arguments = " ".join(args)
shortcut.Save()
好的,这就是我填充数据网格的方式。我还有2个这样的按钮用于乙烯基和卡带。
我是这样做的,因为当我使用private void buttonCD_Click(object sender, RoutedEventArgs e)
{
using (MusicStoreEntities mr = new MusicStoreEntities())
{
dataGridChoice.ItemsSource = mr.ViewOfCD.ToList();
}
dataGridChoice.Columns[0].Header = "Genre";
dataGridChoice.Columns[1].Header = "Musician";
dataGridChoice.Columns[2].Header = "Album";
dataGridChoice.Columns[3].Header = "Price";
}
时,我从选择的表格(CD)和流派中得到了各种各样的行,而且它只是一团糟!
我还有一个按钮擦除,因为当我从数据网格中选择一个项目时,它应该被删除,第一个问题是应用程序如何知道从哪个SQL表中删除项目?第二个问题来自第一个,因为我不能使用
DisplayMemberPath
它给了我一个例外,因为我使用了数据网格的视图!
任何建议?