|
|
Hi there,
On a article posted related to Treelistview control(http://www.codeproject.com/cs/miscctrl/treelistview.asp) .In this example if i enable the checkbox property, all Items in this control display checkbox near to them .
How can i customise this control so that only last leaf node or any particular node display the checkboxes all other nodes will not display the checkboxes.
can some one send me example so get the same functionality
Regard
Anilesh
Anilesh Singh Lakhtakia..........................................................................................................................................................................................................................
-- modified at 6:56 Tuesday 13th June, 2006
|
|
|
|
|
Create User and then Create Role and give different role for different user using C# as front end or UI and for SQLServer
|
|
|
|
|
You want what ? To create a user and a role using code ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi..
How could i make the installation (for my setup project) starts automatically when the user insert the CD that includs it(without open the CDROM directory)?
I am too late but i will never give up
|
|
|
|
|
Just add a file autorun.inf in your CD root directory.
For example : if your setup file is setup.exe, just add these line to your autorun.inf:
open=setup.exe
|
|
|
|
|
Hi,
I want to clone a compound object by MemoryStream.
I wrote the code in the following.
<code>
public object CloneAnObject(object objectToClone)
{
MemoryStream readStream = new MemoryStream();
BinaryFormatter binaryFormatter = new BinaryFormatter();
binaryFormatter.Serialize(readStream, objectToClone);
MemoryStream writeStream = new MemoryStream(readStream.GetBuffer());
return binaryFormatter.Deserialize(writeStream);
close(readStream);
close(wroteStream);
}
</code>
The code usually works well, but sometimes an IOException occurs.
In the help of MemoryStream.GetBuffer(), it seems the memoryStream should be closed before GetBuffer() is executed.
Thank you!
|
|
|
|
|
I want to know how long a particular function in my program takes to run. How can I get the number of milliseconds between two DateTime objects? Or is there a better way to do this?
|
|
|
|
|
I'm no .net expert so I can only give you the Win32 way.
Use QueryPerformanceCounter() and QueryPerformanceFrequency()
Very high resolution timer, I used it all the time when doing game development on Win32. Milliseconds aren't really good enough for this sort of timing btw.
|
|
|
|
|
try this (C#)..
double totalMillisecs = (dt2-dt1).TotalMilliseconds;
rsankarindia
|
|
|
|
|
Thats what I was after. Thank you.
Objects in mirror are closer than they appear
|
|
|
|
|
U can use the following idea..
int t1= Environment.TickCount;
function();
int t2=Environment.TickCount;
int t3=t2-t1;
Console.Writleln("Time consumed : " + t3.ToString());
|
|
|
|
|
Hi,
I would like my web app to output to a webpage via Response.Write() upon pageload... But i dont want it to just blurt it out at the top of tha page as it seems to always do.
Could anyone please tell me how I go about making sure my Response.Write() only outputs between given points/Html tags/etc?
It's not somthing i can simply output to a pre-placed text object as it contains HTML formatting which Response.Write handles and it must also output between specific CSS class tags to recive the correct formatting.
Is Response.Write() what i should be using? or is there another method i should consider?
Thanks
|
|
|
|
|
You can position labels in your HTML and set their text instead. Otherwise, you have no option. it's all to do with in what order the code is called.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
<code><body>
<ASP Repeater Id="CName" Runat="Server">
<%#Container.DataItem("UserName")%>
</ASP Repeater>
</body></code>
i think it will be better
-- modified at 22:32 Monday 5th June, 2006
|
|
|
|
|
If i want to select some icon or a part of text in word or visualstudio editor or select item in the itemlistbox i see a select blu rectangle.
How can use that in my application? i don't want to create it creating a alpha blu fillrectangle with gdi+.
But i want to use methods like ControlPaint
tnx
|
|
|
|
|
Which control do you use ?
if label, then you cannot select the text.
if textbox or richtextbox, then you can select the text using method "Select(int start, int length)".
e.g.
this.textbox.Select(0, 2);
|
|
|
|
|
a small problem
i have two forms one mainform and one frmtoolbar ,
mainform has a menuitem mnu1 and frmtoolbar has a button btn1
in the mainform i am calling frmtoolbar as follows
myToolbar = new frmToolbar();
this.AddOwnedForm(myToolbar);
myToolbar.Visible = false ;
myToolbar.Show();
i want to call menuitem mnu1 from mainform
on the button click event of frmToolbar the btn1
i am getting non - static field error if i make the menu item public in the main form
i am not sure if this can be solved using delegate
please give me an exxample if this is
thanks
|
|
|
|
|
In you're event handler for the button on the frmToolbar Form you can use the Owner property to access an instance of the MainForm. So something like this will work (in frmToolbar)
private void OnButtonClick(object sender, EventArgs e)
{
((MainForm)this.Owner).mnu1_Click(sender, e);
}
You're getting a non-static field error because (I'm taking a logical guess now) that you are referencing the class (hence you have to use a static property / method) when you really want to reference an instance of the class (and get member property / methods).
You don't need to use delegates, you're just not referencing an instance of the MainForm class.
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
EdLast modified: 05 June 2006 17:20:57 -- Used the wrong property, should have been Owner not MdiParent
|
|
|
|
|
wow superv, solved the problem in one shot
was struggling since morning
thanks a lot , saved my day
greetings
Raj
Rule # 17: Omit Needless Words - Strunk, William, Jr.
-------------------------------------------------------------
Shameless selfplug: Universal DBA | Ajax Rating
|
|
|
|
|
I have a repeater control to display thumbnail pictures. The itemtemplate is made of a web image control. When user clicks on the thumbnail picture, I want it to display a larger image in a web image control and display the image description in a label( the image description is saved in database).
My current code is :
I have a getPhoto function which will get the thumbnail pictures through IhttpHandler and bound to the repeater control.
Then I have a repPhotoG_ItemDataBound function, here I add the javascript to the image html control and call a javascript to pass the thumbnail imagename as parameter and show the large image.
Now, I can get the thubnail picture and display the large images, but I just don’t know how to get and display the image description. Please help!!
private void repPhotoG_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
{
//finding repeater item Image
System.Web.UI.HtmlControls.HtmlImage img=(System.Web.UI.HtmlControls.HtmlImage)e.Item.FindControl("iPhoto");
//create a relative path for image and add onclick function
img.Src=img.Src.Replace('\\', '/');
string Description="";
string Image;
Image=IMGpath(img.Src);
img.Attributes["onclick"]="showImg('"+Image+"')";
}
function showImg(imgName)
{
imgOn = ("" + imgName);
document.imgLarge.filters[0].Apply();
document.imgLarge.src = imgOn;
hdr.innerHTML=imgName;
document.imgLarge.filters[0].Play();
-- modified at 17:30 Monday 5th June, 2006
|
|
|
|
|
my project is to implement a basic inventory system using an array of structs.
the struct contains an int, itemNumber, and a method, AddItem.
if i create an array of 100 of the structs, it seems to mean i have 100 copies of the method.
i could make the method static but i'm limited to accessing only static members.
i'm wondering if there isn't a better way.
it seems i should keep AddItem in the same struct definition as itemNumber so i can make itemNumbers' access private.
with this scenario:
1) would i have 100 occurrences of AddItem?
2) is there a better approach than what i've outlined?
i appreciate any comments.
thanks.
matt
|
|
|
|
|
I'm really lost on why you have an AddItem method inside the struct. If you want the itemNumber to be read only, just set it in the constructor and have a property with only a getter. If you want to automatically increase the itemNumber, you can have another static number in the struct and when a new item is created, assign the itemNumber to the static number and increase the static number by one.
Last modified: Monday, June 05, 2006 3:23:58 PM --
|
|
|
|
|
mattlove wrote: 1) would i have 100 occurrences of AddItem?
No, the instructions which constitute a given type's methods only exist in one place per AppDomain.
mattlove wrote: 2) is there a better approach than what i've outlined?
Maybe (the context is not defined well enough)
Josh
|
|
|
|
|
The method is not stored in the data of the struct. Not even a reference to the method. Not even if the method is virtual.
If the int is the only data in the struct, the total size of an instance of the struct will be exactly the same as the size of an int, e.g. four bytes.
---
b { font-weight: normal; }
|
|
|
|