|
Hej i am writing a abstract class with a method that takes
an expression parameter to point to a field....
The field it self is not present in this base class so the the
expression needs to use the subclass so i need to have that type present in the
method definition and the current way i am doing this is..
abstract class foo<SubClass>
{
public void bar(Expression <Func<SubClass , object >> Expression);
}
As you see i need to pass in the subclass type from the subclass to the base class
witch is not ideal since i am not going to be writing the subclass
so my question is how can i use the type of the subclass without passing it as a
parameter.
Thanks for answers in advance .. Patrik
|
|
|
|
|
Hi,
I have a Network drive ("Z:\") mapped to a path say something like ("\\af.sistun.com\storage\MyFolder")which I can detect using the drive info class.
Now considering the DriveInfo class object network holds the drive info about the drive "Z:",
how can I get the full network path that lies beneath "Z:\" i.e. "\\af.sistun.com\storage\MyFolder". After having explored the properties of the DriveInfo class I tried some googling but the examples revealed some ugly MFC type code. Is there some C# way to acheve this?
Thanks for reading this.
Best Regards,
Sid
|
|
|
|
|
No, that's why people are using interop, because they have to.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi Christian,
Thanks for your reply. Can you please help me with the use of Interop.
Which dll, which method do I need to use here.
I am bad with unmanaged code.
Best Regards,
Sid
|
|
|
|
|
I don't really know, I thought you said you'd found some code ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Not really. The code I found was for a different requirement. However it was close to my requirement which made me draw the idea of interop.
Any ways, thanks for your concern I will try finding the solution myself and if I am successful I will post my finding in this thread itself.
Best Regards,
Sid
|
|
|
|
|
I am relatively new to programming(still in school) and cannot figure out this problem.
For my HTPC I use a open source program called Media Browser[^]
In the recent update we lost being able to sort by genre. Well, we can sort by genre but cannot view the images associated with each genre. The original creators have taken a break and are trying to go commercial with the software, while at the same time keeping it open source. I intend to buy(if it is stable when they do go commercial) but while they are getting things sorted the "followers" are left in the dark with the bugs in the new release.
I have tried with my limited knowledge to find the problem to no avail and was hoping someone on here had some time to kill and would download the svn and look at the code. That one problem is all I want fixed perhaps with an explanation of what was wrong so I can learn. I have spent hours looking over the code with no improvements at all.
If no one wants to help, I fully understand. Atleast to me its all greek and takes forever to go through, don't know if its the same for people experienced in the field.
modified on Thursday, July 9, 2009 6:04 AM
|
|
|
|
|
I am creating a file list of all files in a directory, searching each subdirectory and so on.
When I come to a windows shortcut file such as "MUSIC.LNK" I would like to scan and search the
directory that it points to as well.
DirectoryInfo directory = new DirectoryInfo(PSP_Directory[Display, i] + "\\");
FileInfo[] theFiles = directory.GetFiles();
DirectoryInfo[] theSubDirectories = directory.GetDirectories();
foreach (FileInfo theFile in theFiles) <<< The link file MUSIC.LNK can be seen here
{
if (string.Equals(theFile.Name.Split('.')[1].ToUpper(), "LNK"))
{
How do I get the directory infomation from it so that I can redirect my scanning to that directory as well.
Thank you in advance.
Douglas
|
|
|
|
|
I don't know if there's an easy way - but if you scroll down to LNK on this page[^], there are a couple of PDFs you can download which should help.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Got it - you need to add a reference using the COM tab to Windows Script Host Object Model.
Add this to your usings
using IWshRuntimeLibrary;
Then you can do something like this
string shortcutLocation = @"C:\Your Shortcut.lnk";
WshShellClass wsh = new WshShellClass();
IWshShortcut shortcut = (IWshShortcut)wsh.CreateShortcut(shortcutLocation);
Console.WriteLine(shortcut.TargetPath);
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Works like a charm!
Thank you
|
|
|
|
|
Hi ,
i want to specify the maximum number of digits for numeric part and the Decimal part in a text box.
i tried specifying precision and maxlength of the text box but then it if we input the max length then the precesion cannot be inputted and it gets resetted to the maxamount which should not be possible.
like if Maxlength=8
precsion = 2
input required:123456.90 possible
input required : 12345678.89 which is not possible
so is there any way we could specify the format of the numeric part and as well the decimal part. which would restrict for only that particular input format.
like : dddddddd.dd
thanks in advance....
cheers,
sriharsha
|
|
|
|
|
Use a masked edit box.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Hi,
i have tried using masekedit ,
<ajaxtoolkit:maskededitextender id="MaskedEditExtender1" runat="server" acceptnegative="Left" displaymoney="None" mask="9999999.99" masktype="None" messagevalidatortip="true" oninvalidcssclass="MaskedEditError" targetcontrolid="TextBox4" clearmaskonlostfocus="false">
<ajaxtoolkit:maskededitvalidator id="MaskedEditValidator1" runat="server" controlextender="MaskedEditExtender2" controltovalidate="TextBox4" cssclass="InputFieldRed" display="Dynamic"
invalidvaluemessage="Invalid " isvalidempty="false" tooltipmessage="" validationgroup="Search">
;
when for example
input is 12345678.90 no problem
but when
input is 11.11 > it changes to 1111 when i click it again.
and when it is something like
input is 11 .11 it changes to 1111 when i click it again.
is there any way it takes the input in a normal way and also restrict the format required for the number.
thanks and regards,
sriharsha
|
|
|
|
|
Verify whether the decimal-separator is set to a dot - if it thinks that it's a thousand-separator, it will simply remove it from the input
"please help in this regard. give the visual basic code for this as soon possible."
|
|
|
|
|
hi,
i even tried specifying
property Filtered="." of maskededit
but it does not work still the same problem.
what can be done to avoid it ...
thanks ans regards,
sriharsha
|
|
|
|
|
"Filtered"? Didn't you mean Mask [^]?
"please help in this regard. give the visual basic code for this as soon possible."
|
|
|
|
|
Hi,
No
<ajaxtoolkit:maskededitextender id="MaskedEditExtender1" runat="server" acceptnegative="Left" displaymoney="None" mask="9999999.99" masktype="None" messagevalidatortip="true" oninvalidcssclass="MaskedEditError" targetcontrolid="TextBox4" clearmaskonlostfocus="false" filtered=".">
Filtered="." property of maskededitexteneder .
but not working.
where else can we set the decimal...?
thanks and regards,
sriharsha
|
|
|
|
|
In the configuration panel, under "Regional Settings" - but that applies only to the culture of the local computer.
The extender is part of the AJAX-framework, and the control is unknown to me. I suggest asking this question in the ASP.NET forum
"please help in this regard. give the visual basic code for this as soon possible."
|
|
|
|
|
hi,
is there any way through c# we could fix the format or maximum length for numeric part and decimal part.
like
number format: (8,2) only.
thanks
sriharsha
|
|
|
|
|
Information on formatting a string can be found here[^]. That's for display - it won't stop the user from entering three decimals.
You can use the MaskedTextBox.Mask [^] property to get more control on the input.
Good luck
"please help in this regard. give the visual basic code for this as soon possible."
|
|
|
|
|
Hi ,
I used Regularexpression and its working fine.
as:
<asp:regularexpressionvalidator id="regexpName" runat="server"
errormessage="This expression does not validate."
controltovalidate="TextBox5"
validationexpression="^\d{1,8}(\.\d{1,2})?$" enableviewstate="true">;
in
controltovalidate : speicfy the textbox to validate
ValidationExpression: which validates the expression in the format (8,2)
otherwise gives error.
Thanks for all suggestions.
sriharsha
|
|
|
|
|
Hi
Please Help me i get this error when i connect to database
"An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server"
i use this coding
" SqlConnection con;
SqlCommand cmd;
SqlDataReader dr;
private void login_Click(object sender, EventArgs e)
{
con = new SqlConnection("integrated security = true;Database=orcl8i;Password=creative;User ID=itehad");
cmd = new SqlCommand();
cmd.Connection = con;
cmd.Connection.Open();
cmd.CommandText = "Select * from users";
dr = cmd.ExecuteReader();
while (dr.Read())
{
if (usr.Text == dr["userid"].ToString()) && pass.Text == dr["password"].ToString)
{
MessageBox.Show("User Login", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
else
MessageBox.Show("Login Fail")
|
|
|
|
|
I assume that you have a direct link to Code Project on your desktop, and your browser has had the address bar physically torn off it and thrown away in the trash. After all, a quick search returns lots and lots of hits[^] for this. I know that it means you've got some reading to do, but you wouldn't want us to hold your hand for you, now would you?
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Pete O'Hanlon wrote: you wouldn't want us to hold your hand for you, now would you?
is that a trick question?
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|