2009年03月27日

置顶 原创 当存在tabcontrol控件的时候如何让textbox获取焦点 How to let textbox get focus in VB.net if there is tabcontrol in same form

今天遇到一个问题,我的textbox(txt1)无论如何都得不到焦点我尝试了以下函数txt1.focustxt1.selecttxt1.selectallme.ActiveControl = txt1失败查资料后又做了如下设置把txt1的taborder设置成0,检查所有其他控件,并把他们的taborder改成大于0整数  失败我猜测问题在和textbox平级的tabcontrol上, 把tabcontrol的tabstop设置成false       失败然后我怀疑是因为我把代码放在了form load事件里于是把代码移动到 form VisibleChanged 事件里 失败这时我在断点处发现,activecontrol已经正常,但是txt1.canfocus居然是false,而且也没有被选中,实在不知道form内部是如何实现的ta阅读全文>

发表于 @ 2009年03月27日 10:46:00|评论(loading...)|举报|收藏

2007年03月06日

置顶 原创 调用API控制另一程序中按钮问题总结(c#跋涉日记)

在一牛:hbxtlhx(平民百姓) 的帮助和指点以及遍查资料后,总算基本解决了这次遇到的问题。问题需求:在程序A中调用程序B,并且在适当的时机按B上的一个按钮(tabcontrol->groupbox->button),不得改变B程序的代码。解决流程:首先上网查资料,发现要使用API函数using System.Runtime.InteropServices;[DllImport("user32.dll")] public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);[DllImport("user32.dll", CharSet = CharSet.Auto)] public static extern IntPtr PostMessage(IntPtr hwnd, i阅读全文>

发表于 @ 2007年03月06日 14:31:00|评论(loading...)|举报|收藏

2009年07月02日

转载 How to: Count columns in a table for SQL (Get column number for one talbe)


How to: Count columns in a table for SQL (Get column number for one talbe)

SELECT count(*) FROM information_schema.columns WHERE table_name = ''阅读全文>

发表于 @ 2009年07月02日 14:46:00|评论(loading...)|举报|收藏

2009年06月26日

转载 Response.OutputStream.Write Out of Memory 下载太大的文件的时候,内存使用太多

Solution:按字节来取     private   void   Page_Load(object   sender,   System.EventArgs   e)     {     string   strDocDir;     string   strFile;     strDocDir="updownload";     strFile=Request.QueryString["strFile"];     System.IO.Stream   iStream   =   null;     //   Buffer   to   read   10K   bytes   in   chunk:     byte[]   buffer   =   new   Byte[300000];     //   Length   of   the   file: 阅读全文>

发表于 @ 2009年06月26日 16:49:00|评论(loading...)|举报|收藏

2009年06月04日

转载 Code For Posting (for post xml to another page)

Code For Posting
To post XML, use the following function: Collapse Copy Code WebRequest req = null; WebResponse rsp = null; try { string fileName = "C:\test.xml"; string uri = "http://localhost/PostXml/Default.aspx"; req = WebRequest.Create(uri); //req.Proxy = WebProxy.GetDefaultProxy(); // Enable if using proxy req.Method = "POST"; // Post method req.ContentType = "text/xml"; // content type// Wrap the request stream with a text-based 阅读全文>

发表于 @ 2009年06月04日 11:44:00|评论(loading...)|举报|收藏

Csdn Blog version 3.1a
Copyright © 自说自话