|
I'm trying to work with combo box, which will display graphically data I store in access DB. Each index no. has a column in the DB. means: choose option with index 1 from drop down list; get data & graph for column 1. Very simple & strait forward. I just cannot seem to grasp the idea of this combo box & what's running it. What is the event which will trigger the change of display? How do I pass item index no. to the method that connected to DB?
You may send me a link to a site where I can view some simple examples of those? I've been looking all over & couldn't find something useful.
sea#
|
|
|
|
|
--------------------------------------------------------------------------
I have a NET problem
In java I ahave made a NetCalculator bla bla and I needed a method
like this one:
public byte [] getBytes ()
{
return InetAddress.getByName(this.ip).getAddress();
}
Now I want to port this in C# all fine but I need to return the
"byte[]" the ".getAddress();" does this but in C# tthe
public byte [] getBytes ()
{
return Dns.GetHostByName(this.ip).AddressList;
}
Returns something else...
How can I convert this to c#?
THX...
--------------------------------------------------------------------------
How About this?How can I convert this java code to c#
public static String nsLookup(String nsl)
{
String nslookup;
InetAddress address = null;
try
{
/* // Get hostname
address = InetAddress.getByName(nsl);
nslookup = address.getHostName();
*/
nslookup = Address.getHostName(InetAddress.getByName(nsl));
}
catch (Exception uhe)
{
nslookup = "unknown";
}
return nslookup;
}
--------------------------------------------------------------------------
(o)(o)
|
|
|
|
|
Hello,
I have developed two versions of an application, with one of them using regular expressions. It's code is much more clear and maintainable, but the problem is the program runs slower. I know there are some rules in building efficient expressions, but I don't have too much expirience using regex. Could you please provide some tips?
Thanks
|
|
|
|
|
Show us the regular expressions and maybe someone can point out some of your inefficiencies. Btw, if you have .* in there then chances are it's gonna be extremely inefficient.
Regards,
Brian Dela
Blog^
Co-author of The Outlook Answer Book... Go on, pre-order^ it today!
Regular Expression Library builder^
|
|
|
|
|
Hi,
create\s+(procedure|function)\s+[\w_\.-]*\s*\(.+\n*\)(.*\n)*?begin(?<fid>(.*\n)+?)end
With this expression I'm trying to retrive the body of a stored procedure. I don't see how to avoid the .* and .+ . Any advices?
Regards
|
|
|
|
|
You can replace all your .*\n with [^\n]* which is the same but more efficient... plus, if you had singleline mode turned on your regex would probably break as it is (or it might be more efficient ith a little tweaking ... depending on what area you are trying to capture. I'd also replace the .+\n with [^\n]+ and you should use named captures and turn on explicit capturing... that should speed up your regex a lot.
Post a few examples of what you want to match and I'll see what I can come up with.
Regards,
Brian Dela
Blog^
Co-author of The Outlook Answer Book... Go on, pre-order^ it today!
Regular Expression Library builder^
|
|
|
|
|
Hi Brian,
Doesn't [^\n] stand for anything but new line character?
Basically I'm trying to get the body of a procedure or function by the name. For example:
create function dbo.user_id(in @user_name char(128) default
null)
returns integer
on exception resume
begin
declare id integer;
select user_id into id
from SYS.SYSUSERPERMS where
user_name = isnull(@user_name,current user);
return(id)
end
What I need is the part between begin and end.
Thanks for helping !
|
|
|
|
|
Anonymous wrote:
Doesn't [^\n] stand for anything but new line character?
Ah, yes... mis read your expression.
This regex will do:
(?smnx-i)begin\n(?<StoredProcBody>.*)end
The body is stored in the named capture StoredProcBody
Regards,
Brian Dela
Blog^
Co-author of The Outlook Answer Book... Go on, pre-order^ it today!
Regular Expression Library builder^
|
|
|
|
|
Dear all,
I am not too sure whether I can post this here.
I hope I am not advertising. I am working on a community project to share to the public on obfuscation.
I had prepared a set of questionnaires and hope you can fill in. I know it is quite trouble some.
http://nos.blogsome.com/2005/07/17/noos-questionnaires/
Thank you.
Cheers.
Regards,
Chua Wen Ching
Visit us at http://www.necoders.com
|
|
|
|
|
now i can get the window handle of the desktop listview , but till now i dont know how to set it to autoarrange icons, is there any way can do this
|
|
|
|
|
Why?
Alex Korchemniy
|
|
|
|
|
coze i am devloping a software that manage desktop icons
|
|
|
|
|
hi, there are two query string i want to combine them
string str = "xyz";
double waist = 123;
string query1 = "delete from Trouser where Company = " + "'" + str + "'";
string query2= "delete from Trouser where Waist = " + waist ;
i want to make them one using "where" clause. plz help me i will be very thankful to u.
|
|
|
|
|
|
i want to redirect (windows logo key +D) to another windows shortcut key (windows logo+M), is there any way to do this using C# ?
|
|
|
|
|
See: RegisterHotKey function in MSDN
Tip: perform a search on google "registerhotkey site:msdn.microsoft.com"
Alex Korchemniy
|
|
|
|
|
i know this, but its still not the solution coze first i have to catch the message of (win logo+D) then disable it -(all the time when my program is running)- and then send another message (win logo+M)
thats all
|
|
|
|
|
hi to all,
i am trying to get all registered file extensions on a system so i can filter queries to the filesystem that is displayed in a ListView Control
i am iterating the subkeys of CLASSES_ROOT but i am getting alot of keys that do not appear within the display of the Windows 'add new file type' list box. is there a way to only get this list of extensions ?
i will paste my code which basically just gets all subkey names starting with '.'
<br />
public IList<string> GetFileTypes()<br />
{<br />
IList<string> fileTypes = new List<string>();<br />
RegistryKey root = Registry.ClassesRoot;<br />
string[] subkeys = root.GetSubKeyNames();<br />
<br />
foreach (string key in subkeys)<br />
{<br />
if (key.StartsWith("."))<br />
{<br />
fileTypes.Add(key.Substring(1));<br />
}<br />
}<br />
return fileTypes;<br />
}<br />
thanx to all,
g00fy
|
|
|
|
|
ok so i can get them now without any problems, the same as MS file types window but the icon is not displayed, y is this so ?
i am definitley getting the icons (both large and small) i can see it when debugging, but they dont appear in listview control, my code is long so i will have to email if someone can help but i am basically
...
iterating the registry keys to find file types, adding the small and large icons to thier respective imagelists (iteratively) and then adding the string array of extension and description to the listviews items list (also iteratively).
...
this is all done in InitaliseValuesInControl()
<br />
public FileTypeControl()<br />
{<br />
InitializeComponent();<br />
<br />
handler = new IconHandler();<br />
fileEntries = new Dictionary<string, FileType>();<br />
<br />
InitaliseValuesInControl();<br />
<br />
}<br />
i have tried to pull all code from InitializeComponent() and put it into the InitaliseValuesInControl() method so i was drawing the control after the imagelists and item list were populated but it still doesnt display the image.
any ideas please ?
kind regards,
g00fy
|
|
|
|
|
I fixed it, found an overload method i could use
|
|
|
|
|
I am using a dllimport of SHGetFileInfo to retrieve a file icon, and then add it to an image list.
is there something i need to disposse ?
this line
<br />
this.iconsListSmall.Images.Add( FileGetIcon( fi.FullName, true ) );<br />
and this function
<br />
public static Icon FileGetIcon( string strPath, bool bSmall )<br />
{<br />
<br />
SHFILEINFO info = new SHFILEINFO( true );<br />
uint cbFileInfo = ( uint )Marshal.SizeOf( info );<br />
SHGFI flags;<br />
if ( bSmall )<br />
flags = SHGFI.Icon | SHGFI.SmallIcon | SHGFI.UseFileAttributes;<br />
else<br />
flags = SHGFI.Icon | SHGFI.LargeIcon | SHGFI.UseFileAttributes;<br />
<br />
SHGetFileInfo( strPath, 256, out info, cbFileInfo, flags );<br />
return System.Drawing.Icon.FromHandle( info.hIcon );<br />
}<br />
|
|
|
|
|
Well if you search google: "SHGetFileInfo site:msdn.microsoft.com"
You will see towards the bottom of the page: If SHGetFileInfo returns an icon handle in the hIcon member of the SHFILEINFO structure pointed to by psfi, you are responsible for freeing it with DestroyIcon when you no longer need it.
Alex Korchemniy
|
|
|
|
|
so should i
<br />
icotmp = FileGetIcon( fi.FullName, true );<br />
this.iconsListSmall.Images.Add( icotmp );<br />
<br />
DestroyIcon( icotmp.Handle );<br />
or
<br />
icotmp.Dispose();<br />
or should i free it in FileGetIcon() before returning the copied icon in a system.drawing.icon
<br />
FileGetIcon()<br />
..<br />
DestroyIcon( info.hIcon );<br />
Icon ico = System.Drawing.Icon.FromHandle( info.hIcon );<br />
return ico;<br />
|
|
|
|
|
Hello! (Two posts in a row!)
Question now is, how do I take screenshots in C#? I searched for articles but the only one I found was for C++...
Thanks!
Darth_Sulfur (Sulfurik)
http://www.SulfurSoft.tk
ftp://tsfc.ath.cx
http://tsfc.ath.cx
hotline://tsfc.ath.cx
|
|
|
|
|