我有两个表单A和B.表单A是应用程序的默认启动表单.我在表单A中做了一些事情然后我想要并行运行我的表单B,然后将表单B中的参数传递给表单B中的方法.
怎么样 ?
在以下代码中获得上述错误.如何纠正它.谢谢.请找
protected override void Finalize() { Dispose(false); }
Run Code Online (Sandbox Code Playgroud)
在下面的代码中.
using Microsoft.Win32;
using System.Runtime.InteropServices;
public class Kiosk : IDisposable
{
#region "IDisposable"
// Implementing IDisposable since it might be possible for
// someone to forget to cause the unhook to occur. I didn't really
// see any problems with this in testing, but since the SDK says
// you should do it, then here's a way to make sure it will happen.
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual …
Run Code Online (Sandbox Code Playgroud) 我在c#winforms中完成了一个项目.当应用程序在任何PC上运行时,我想将屏幕的分辨率设置为1680 x 1050.怎么做 ?
我的mysql表中有Date字段.我想通过Windows窗体c#的日期选择器控件插入日期.怎么样 ?
当我尝试使用下面,我收到错误.
代码:
DB.Insert_Orders(Convert.ToInt32(txtA.Text), Convert.ToInt32(txtB.Text), Convert.ToInt32(txtC.Text), DTP_date.Value.ToString("yyyy/MM/dd"));
Error :
{MySql.Data.MySqlClient.MySqlException: Incorrect datetime value: '15' for column 'Date' at row
Run Code Online (Sandbox Code Playgroud) 通常的方式,我编写XML文件的代码是,
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
XmlWriter writer = XmlWriter.Create("Products.xml", settings);
writer.WriteStartDocument();
writer.WriteComment("This file is generated by the program.");
writer.WriteStartElement("Product");
writer.WriteAttributeString("ID", "001");
writer.WriteAttributeString("Name", "Keyboard");
writer.WriteElementString("Price", "10.00");
writer.WriteStartElement("OtherDetails");
writer.WriteElementString("BrandName", "X Keyboard");
writer.WriteElementString("Manufacturer", "X Company");
writer.WriteEndElement();
writer.WriteEndDocument();
writer.Flush();
writer.Close();
Run Code Online (Sandbox Code Playgroud)
但上面的代码给了我一个不同的XML结构,如果我需要输出如下给定结构,如何编码,
<Books>
<Book ISBN="0553212419">
<title>Sherlock Holmes</title>
<author>Sir Arthur Conan Doyle</author>
</Book>
<Book ISBN="0743273567">
<title>The Great Gatsby</title>
<author>F. Scott Fitzgerald</author>
</Book>
<Book ISBN="0684826976">
<title>Undaunted Courage</title>
<author>Stephen E. Ambrose</author>
</Book>
<Book ISBN="0743203178">
<title>Nothing Like It In the World</title>
<author>Stephen E. Ambrose</author>
</Book> …
Run Code Online (Sandbox Code Playgroud) 我写了一个在后台运行的应用程序.我想写一个代码,这样,当按下"ctrl + Alt + Q"时,我应该提示用户一个消息框,"你确定要退出吗?".它是ac#windows应用程序.
谢谢.
我使用下面的代码来禁用Alt + Tab,Alt + Esc,Ctrl + Esc和Windows Key但不知何故它不起作用.请帮我纠正.
namespace BlockShortcuts
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private delegate int LowLevelKeyboardProcDelegate(int nCode, int
wParam, ref KBDLLHOOKSTRUCT lParam);
[DllImport("user32.dll", EntryPoint = "SetWindowsHookExA", CharSet = CharSet.Ansi)]
private static extern int SetWindowsHookEx(
int idHook,
LowLevelKeyboardProcDelegate lpfn,
int hMod,
int dwThreadId);
[DllImport("user32.dll")]
private static extern int UnhookWindowsHookEx(int hHook);
[DllImport("user32.dll", EntryPoint = "CallNextHookEx", CharSet = CharSet.Ansi)]
private static extern int CallNextHookEx(
int hHook, int nCode,
int wParam, ref KBDLLHOOKSTRUCT …
Run Code Online (Sandbox Code Playgroud) 我正在使用以下代码禁用热键,如Alt + f4,ctrl + c,它们运行正常.但我无法使用以下代码注册win + L.
namespace KioskMode
{
public partial class Test : Form
{
#region Dynamic Link Library Imports
[DllImport("user32.dll")]
private static extern int FindWindow(string cls, string wndwText);
[DllImport("user32.dll")]
private static extern int ShowWindow(int hwnd, int cmd);
[DllImport("user32.dll")]
private static extern long SHAppBarMessage(long dword, int cmd);
[DllImport("user32.dll")]
private static extern int RegisterHotKey(IntPtr hwnd, int id, int fsModifiers, int vk);
[DllImport("user32.dll")]
private static extern int UnregisterHotKey(IntPtr hwnd, int id);
#endregion
#region Modifier Constants and Variables
// Constants for …
Run Code Online (Sandbox Code Playgroud) 我是网络服务新手,
数据库访问应该通过Web服务使用ADO.NET来访问存储过程.
有任何想法吗 ?
string Example 1 : abc /
string Example 2 : abc / cdf / /
string Example 3 : abc / / / /
string Example 4 : / / / / /
string Example 5 : abc / / xyz / / /
Run Code Online (Sandbox Code Playgroud)
我需要在很多场景中删除字符串中的斜杠.我猜这些情景在下面的预期结果中是自我解释的.
结果:
string Example 1 : abc
string Example 2 : abc / cdf
string Example 3 : abc
string Example 4 :
string Example 5 : abc / xyz
Run Code Online (Sandbox Code Playgroud)
如何使用vng.net这样做?
c# ×9
.net ×1
asp.net ×1
destructor ×1
finalizer ×1
hotkeys ×1
idisposable ×1
mysql ×1
vb.net ×1
wcf ×1
web-services ×1
windows ×1
winforms ×1
writexml ×1
xml ×1