|
Guffa wrote: No, you can't cast an object to a class the inherits from the class of the object. You can only cast an object to any of it's base classes.
Just wanted to mention that it is legal C#, only not a recommended practice. C# does allow casting down to the derived class.
Regards
Senthil
_____________________________
My Blog | My Articles | My Flickr | WinMacro
|
|
|
|
|
Hi All!
My MDI parent form creates a child form. Then I maximize it.
The icon of the child form appeares above main menu line. Not on the left of first item of menu.
How can I place child form icon and menu strip of the parent form in the same line?
Is it possible?
My application created in VS2005, C#, WinForms.
|
|
|
|
|
Are you using the Menustrip control that comes with .Net or a 3rd party menu control? I used MagicLibrary MenuCommand in one of my MDI apps which caused similar issue. I ended up using the standard menu bar.
- Malhar
|
|
|
|
|
malharone wrote: Are you using the Menustrip control that comes with .Net or a 3rd party menu control? I used MagicLibrary MenuCommand in one of my MDI apps which caused similar issue. I ended up using the standard menu bar.
Thank you!
|
|
|
|
|
Can any1 tell me where to get
PINVOKE.NET Add-In for Visual Studio
that would work with VS 2003 (DotNet FrameWork 1.1)...
o O º(`'·.,(`'·., ☆,.·''),.·'')º O o°
»·'"`»* *☆ t4ure4n ☆* *«·'"`«
°o O º(,.·''(,.·'' ☆`'·.,)`'·.,)º O o°
|
|
|
|
|
|
Hi every body how i can get data from SqlDataSource1 ?
|
|
|
|
|
here is one simple example
SqlDataSource1.ConnectionString = "your connection string";<br />
SqlDataSource1.SelectCommand = "select * from table";<br />
DataGridView1.DataSourceID = "SqlDataSource1";
|
|
|
|
|
I need just to take only one column how to do that
|
|
|
|
|
In property of GridView1 Edit columns uncheck AutoGenerate Fields add one DataBoundField.
in Property of BoundFields:
HeaderText - Displays text of column
SortExcpression - Here define Column for sorting Excpresion
DataField - Here define column for displaying data in GridView
SortExcpression and DataField must be same coumn otherwise u get error
|
|
|
|
|
No i need it to put it in array how i can get data like array??
|
|
|
|
|
I don't want to show this information i just need it to be push it in array is that possible and how?
|
|
|
|
|
Hi.
As most or all of you fine folks know many software companies license their products to a user for a certain time. Let´s say a user bought a program a year ago and it expired today. Then it stops working. How is this done? I also assume that this feature needs to work on computers that don´t have an internet connection.
Is there a thread in the program that checks to see if the time is such and such and then some features in the program are disabled?
Thanks for your help.
F
|
|
|
|
|
i think they write something hidden in the registry... notice that after reinstalling windows the blocade disappears. every time you launch the program it checks wheter trial period expires or not. that's it...
anyway i just guess... i don't know that for sure .
|
|
|
|
|
Almost every time I try to load my source safe bound solution containing a webservice project located on my local IIS I end up with a dialog box that says that the webservice project can't be found. No matter what you click or do you end up loading the solution without the webservice project.
The trick is that you have to remove the webproject from the loaded solution and then add it again, this way round it works.
The webservice project is located on the project directory structure, it's not under wwwroot...
did anybody face the same problem and found a solution to this anyoing problem?
myMsg.BehindDaKeys = "Jerry Maguire";
|
|
|
|
|
I have one of my c# applications coded using .net framework 1.1, which works fine.
Recently I installed Visual Studio 2005 - Professional edition on the same machine
(Arter formating and reinstalling Windows 2000 with SP4) and now the above application
takes a long time to open the connection to SQL Server 7.
My connection string is as follows
"user id=sa;password=;initial catalog=FINISHED_GOODS_STOCK;data source=naturubmain;Connect Timeout=30"
Once I try to open the connection it gave me 'Time out expired' error. I set the 'Connect Time out' to 0
just to find how long does it take to open the connection. It took above 1 minute and opend the
connection.
Pls help me. Withot fixing this I will not be able to enjoy the new features of VS2005
Thanx a lot
|
|
|
|
|
It might be a problem with name resolution in your network. Check what happens if you use the ip address of the server instead of the name.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks a lot. It works fine when server name is replaced with ip address.
|
|
|
|
|
Hi
How can I create and write files with C#
For instance, I have a file on my C drive. I want to create the same file on D drive.
Is there an example on the web that I can follow to create & write Files.
(in future, I would also need to upload files to my Web server space without using HttpPostedFile)
Any help appreciated
Regards
|
|
|
|
|
google around before you ask a question like that...
check for System.IO.File class... it has all the methods you need like copy create etc. it also has streamreader and writer to enable you editing files.
-- modified at 6:23 Friday 7th April, 2006
|
|
|
|
|
Thanks
Whenever, I post a question, I do a thorough search on Google.
But unfortunately, I did not find any example.
regards
|
|
|
|
|
ok... anyway i think that tnow when you know which class to use you can do it, because it's quite intuitious.
regards
|
|
|
|
|
hi All,
I am attaching the code of my C# console application. it is a keyboard hook. but its not working.. the program exits b4 any key is pressed.
using System;
namespace hooksample
{
using System;
using System.Runtime.InteropServices;
namespace hooks
{
public class Class1
{
#region Hook Variables
public struct KeyboardHookStruct
{
public long vkCode;
public long scanCode;
public int flags;
public long time;
public long dwExtraInfo;
};
private const int HC_ACTION = 0;
private const int LLKHF_EXTENDED = 0x01;
private const int LLKHF_ALTDOWN = 0x20;
private const long VK_T = 0x54;
private const long VK_P = 0x50;
private const long VK_W = 0x57;
private const int VK_TAB = 0x9;
private const int VK_CONTROL = 0x11;
private const int VK_ESCAPE = 0x1B;
private const int WH_KEYBOARD_LL=13;
protected IntPtr KeyboardHandle = IntPtr.Zero;
private static int mHook;
#endregion
public Class1()
{
Install();
}
public static void Main()
{
Class1 classnew =new Class1();
}
#region Hook Functions
private delegate int KeyboardHookProcDelegate(int nCode, int wParam, int lParam);
public static int KeyboardHookProc(int nCode, int wParam, int lParam)
{
KeyboardHookStruct HookStruct;
int ret = 0;
Console.WriteLine("inside HookProc");
HookStruct = ((KeyboardHookStruct) Marshal.PtrToStructure(new IntPtr(lParam), typeof(KeyboardHookStruct)));
long vkCode= HookStruct.vkCode;
int flag = HookStruct.flags;
if(nCode==HC_ACTION)
{
Console.WriteLine("inside nCode==HC_ACTION");
if(vkCode == VK_T )
{
Console.WriteLine(" found T ");
if((GetAsyncKeyState(VK_CONTROL) & 0x8000) != 0)
{
Console.WriteLine("Play");
ret=1;
}
else if((flag & LLKHF_ALTDOWN)!=0)
{
Console.WriteLine("Stop");
ret=1;
}
}
else if(vkCode == VK_P)
{
Console.WriteLine(" found P ");
if((GetAsyncKeyState(VK_CONTROL) & 0x8000) != 0)
{
Console.WriteLine("pause");
ret = 1 ;
}
}
else if(vkCode == VK_W)
{
Console.WriteLine(" found W ");
if((GetAsyncKeyState(VK_CONTROL) & 0x8000) != 0)
{
Console.WriteLine("Save");
ret = 1 ;
}
}
}
if( ret == 0 )
{
ret = CallNextHookEx(mHook,nCode,wParam,lParam);
}
return ret;
}
public void Install()
{
Console.WriteLine("inside Install");
mHook=SetWindowsHookEx(WH_KEYBOARD_LL,new KeyboardHookProcDelegate(KeyboardHookProc),IntPtr.Zero,(int)AppDomain.GetCurrentThreadId());
if(mHook!=0)
{
Console.WriteLine("unable to install");
}
else
Console.WriteLine("Success in Installing!");
}
public void UnInstall()
{
Console.WriteLine("inside UnInstall");
if(mHook!=0)
{
Console.WriteLine("inside mHook!=0 ");
UnhookWindowsHookEx(mHook);
}
}
#endregion
#region Hook Win32Imports
[DllImport("user32.dll")]
private static extern int SetWindowsHookEx(int code,
KeyboardHookProcDelegate func,
IntPtr hInstance,
int threadID);
[DllImport("user32.dll")]
protected static extern bool UnhookWindowsHookEx(int hhook);
[DllImport("user32.dll")]
protected static extern int CallNextHookEx(int hhook,
int code, int wParam, int lParam);
[DllImport("user32.dll")]
private static extern short GetAsyncKeyState(int vKey);
#endregion
}
}
}
i need to know whether i have done the hook correctly?
y its not working?
waiting for a reply.
thanks in advances.
lmhp
|
|
|
|
|
|
hello,
thanks .but i have tried to use this.But it is not doing the required work.This made me develope my own code.
Both in same state on.Please suggest me a solution.
thanks.
lmhp
|
|
|
|