|
Hello..
I have a ListView with CheckBoxes = TRUE. If I set FullRowSelect to TRUE, by DoubleClick (for example in Column 5) is the checkbox automatically set to TRUE or FALSE. How to avoid this ?
I want to use FullRowSelect (because of DoubleClick) but I don't want to change the state of CheckBox.
CheckBox state can only be changed, if user click on checkbox, not on "anywhere" in row.
Thx..
|
|
|
|
|
I assume you'd have to derive a class from teh control, handle the click and stop it from changing the state of the control if it's not in the right area.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi all,
I don't understand most of this "Indexer" code :
namespace UsingIndexers
{
class TestIndexers
{
private string[] MyStrings;
public TestIndexers()
{
MyStrings = new string[] { "This", "is", "an", "indexer", "test" };
}
// array like access
public string this[int index]
{
get
{
if (index < 0 || index >= MyStrings.Length)
{
throw new ArgumentOutOfRangeException();
}
return MyStrings[index];
}
set
{
if (index >= MyStrings.Length)
{
throw new ArgumentOutOfRangeException();
}
else
MyStrings[index] = value;
}
}
static void Main()
{
TestIndexers MyIndexer = new TestIndexers();
Console.WriteLine("index 1 is: {0}", MyIndexer[1]);
}
}
}
Especially I don't understand the use of indexers. Every individual element of MyStrings can be accessed through MyStrings[i]. WHy still additional code for indexing ?
And also this line of code is difficult for me :
public string this[int index]
What is the meaning of "this" ?
Any help is very much appreciated...
Many thanks in advance !!
Best regards, Steve
|
|
|
|
|
Steve Declerck wrote: Every individual element of MyStrings can be accessed through MyStrings[i]. WHy still additional code for indexing ?
But your data should be private. The indexer allows you to expose a public interface (don't confuse that with a C# interface ) for your private data. Of course, you could do away with an indexer and use a GetXXX(int index) method, but indexers are elegant. You are not limited to integers; you can also use other types for the indexer.
Steve Declerck wrote: public string this[int index]
What is the meaning of "this" ?
this is a keyword used to refer to the home object, i.e., the object on which the code is operating.
I don't mean to be condescending, but a good book will explain all of this in greater detail. I'd recommend Andrew Troelsen.
Cheers,
Vikram.
The hands that help are holier than the lips that pray.
|
|
|
|
|
Hello Vikram,
Thank you very much for your fast reply ! I understand it now...
Thanks, Steve
|
|
|
|
|
Yeah, what Vikram said.
Plus, the actual data needn't be stored in an array.
An indexer could be implemented with a database query.
The data needn't be stored anywhere at all; one could write a factorial method as an indexer:
private ulong
this
[
ulong i
]
{
get
{
for ( ulong j = i - 1 ; j > 1 ; j-- )
{
i *= j ;
}
return ( i ) ;
}
}
(Though that's fairly silly.)
|
|
|
|
|
hi all
i instaled in My PC Visual Studio 2005 and I Wount to use the WorkFlow Project , what it's need to enable the template workflow in Visual Studio 2005 .
if it need FramewWOrk 3.5 i instaled it but it is not enable .
what i can do to enable it .
thanks for all
Thaer
|
|
|
|
|
|
Thanks Mr John Adams
i instaled it . and it's Ok But the Desinger is Error
the Error Is :-
The designer could not be show for this file becouse none of the classes within it can be
designed .
what i can dot for this problem ?
Thanks Mr
Thaer
|
|
|
|
|
For VS 2005, After Installing Framework 3.0 you have to install WWF Extention .
Best Regards
-----------------
Abhijit Jana
"Success is Journey it's not a destination"
|
|
|
|
|
|
Thanks Mr Abhijit Jana
i instaled it . and it's Ok But the Desinger is Error
the Error Is :-
The designer could not be show for this file becouse none of the classes within it can be
designed .
what i can dot for this problem ?
Thanks Mr
Thaer
|
|
|
|
|
Hi,
I'm playing around with picture boxes at the moment, and was wondering...
Is there a way to stop a PictureBox from redrawing itself, so that I can draw a shape over the top of it using the form's onPaint event?
Cheers,
|
|
|
|
|
Once you start to handle the paint event, you've moved past the picture box, which is here to help people add plain images easily
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Override OnPaint handler:
protected pverride void OnPaint(System.Windows.Forms.PaintEventArgs pe)<br />
{<br />
base.OnPaint(pe);<br />
<br />
...<br />
}
|
|
|
|
|
Yes, but at this stage, it's kind of pointless, isn't it ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Yes, but try it, it still does not draw over the top of a picturebox, only behind it.
I think Christian is right tho, its kind of pointless. I just wanted to know if it was possible to stop the picturebox re-rendering itself.
|
|
|
|
|
// Make sure a duplicate file doesn’t exist. If it does, keep on appending an incremental numeric until it is unique
string sFilename = System.IO.Path.GetFileName(myFile.FileName);
string ans;
while (System.IO.File.Exists(Server.MapPath(sSavePath + sFilename)))
{
Console.Write("Do you want to overwrite? (Yes/No)");
ans = Console.ReadLine();
Console.WriteLine("");
}
lblOutput.Text = "File already existed. A duplicate file has been created";
the logic is upload file -> if file exists -> prompt for user input -> if yes -> overwrite -> if no prompt for user input for new file name
the code is not finished.. but am i on the right path??
|
|
|
|
|
Seems a bit lost to me
1 - you're using server.mappath, but you're writing to the console, is this a server application or not ?
2 - sSavePath + sFilename, why not use Path.Combine ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
1.sorry but what do you mean by server application?
i'm doing asp.net c#.. images upload
2. oh path.combine works too? oh so ty lol
|
|
|
|
|
OK, then this is a disaster. Your console code plainly is not going to work on a website, now is it ?
If you asked in the right forum, I'd have known for sure this was ASP.NET. If the code stood any chance of working, I may have figured it out. C# code runs on te server, not the client.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi
I want to create wrapper class dynamically. so i try to execute the command window programmatically. but i dont know how i can set the argument "TLBIMP compadd.dll \out:comprcw.dll". can anyone please tell me?
thanks
sri
|
|
|
|
|
You want to pass parameters to a process? Create a Process instance and set Arguments and FileName of its StartInfo property.
Cheers,
Vikram.
The hands that help are holier than the lips that pray.
|
|
|
|
|
I see a lot of VBscripts that map printers from a network drive/print server. My question is if this is possible with C#. I am more familiar with C# and not VB. At work we want to add a logon script (or have a console app pop up and automatically do this) and we want it to map all the network printers from our print server on the users computer (at each login).
I see how to manually map the printers with VBscript but the problem with this is if we delete a printer or rename it then we have to change the script.
If we have it delete the currently mapped printers and remap all the printers from the print server then we wouldn't have to worry about it. So can this be done with C# or is this a VBscript thing? I have asked this question in the VB form about doing it in VB but now I'm asking here to see if it is possible to do it with C# in a console app or something.
|
|
|
|
|
Yes there is. but it won't be a c# script or anything like that.
this can be done using visual studio 2005 or 2008. add a reference to your project "IWshRuntimeLibrary" it is a .COM library from a dll.
using IWshRuntimeLibrary;
public class x;
{
private void mapPrinter();
{
WshNetwork oNet = new WshNetwork();
oNet.AddWindowsPrinterConnection"\\\\SERVER\\printerName", "HPLJ4100", "\\\\SERVER\\printerName");
oNet.SetDefaultPrinter("\\\\SERVER\\printerName");
}
}
I hope this helps with this kind of project/s.
|
|
|
|