|
Hi,
The horizontal scroll bar is placed below the panel and when I am trying to move the scroll bar the event didn't get fired.
private void hScrollBar1_Move(object sender, System.EventArgs e)
{
MesasgeBox.Show("Scroll bar Moved");
}
When I am moving the scroll bar to left or right the above message box doesn't appear.
Regards,
Subbu
|
|
|
|
|
I think, what you want is event "Scroll", and not "Move".
|
|
|
|
|
Thanks for your reply...
But i don't want to scroll instead I will click the extreme right.
Suppose consider this is the horizontal scroll bar i want to move the contents of the panel by click the extreme right position(as shown in BOLD)
<------------------------------>
How to fire that event?? I tried with scroll it works fine for scrolling the bar and not working at the clicking of extreme right position.
How to acheive this?
Reg,
Subbu
|
|
|
|
|
Any idea Please?
Just click the extreme right end and any events are there. I am using VS.Net 2003. (Bold position)
<-----------------------------> (horizontal scroll bar)
Reg,
Subbu
|
|
|
|
|
Hi,
In the other response it was suggested that you have subscribed to the Move event and the method signature given would support that hypothesis. What you need is the Scroll event.
Alan.
|
|
|
|
|
Cutting right into my host of questions, here is a crackdown of my class:
class TheDocument
{
private TheData[] _list;
public TheDocument(TheData[] list)
{
_list = list;
}
public static void Print(TheData[] list)
{
TheDocument d = new TheDocument(list);
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler(d.PrintPage);
pd.Print();
}
private void PrintPage(object sender, PrintPageEventArgs ev)
{
}
}
Explaining above code, I came to decide that I need no multiple instances of this document-printing class so I made static Print() method which will initialize the instance and does the trick. So from my application I can just call TheDocument.Print(...); and nothing else.
The question is, I couldnt find a way to pass around TheData[] array in other way than either trough constructor or after construction setting it to the instance of an object. This is where all my questions start to roam and I find myself a bit off track; This static method is instance of the calling instance? So within new TheDocument instance I have no access to it without reference?
All the printing stuff is merely serving as an example. My real world solution will inherit from more robust printing class and only contain the code for a specific type of document. I know theres plenty of 3rd party solutions for document designing and using them to print, but I will have host of different types of "simple list" kind of documents to print and decided to take this brute approach.
Coming from VB and C(embedded) programming all this OOP and fancy C# stuff are so overwhelming Feels like I need proper OOP course or something since I dont even know if there is a term to call class with static method which will make instance of the class itself in it. Or if the whole class is static, is there a name for it instead of saying "static class". Another question about OOP I would ask is if I have alot of variables or properties in one object and define new object in it, what is the best way of accessing those variables or properties. Handing out reference to "parent" object kind of makes that approach less encapsulated?
|
|
|
|
|
Your method seems to me that it should not be static, because it wants to use the member data of the class instances. Unless you will have a TheData[] on hand, but no TheDocument class, and just want to print it.
The easiest way to pander to both is to write a method like this
public void Print()
{
TheDocument.Print(this._list);
}
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.
|
|
|
|
|
Generally, static methods shouldn't be creating instances of the class they 'live' in. If a static method requires access to instance fields/properties/methods then it should probably not be static as it's working on instance data. A general exception is in situations where an instance wouldn't previously exist but will do at the end of the method. A good example is int.Parse . This (in it's simplest form) takes a string as a parameter and it creates an int from it. It would make no sense to have this as an instance method in the int struct as until the string is parsed, there is no int.
In your situation, your Print method is obviously related to a TheDocument instance so I would remove the static and the parameter. If I wished it to be static for convenience, I would rename it to PrintTheDocument , so it's obvious the method is only for printing TheDocument instances, and take an instance of the class as a parameter,
public static void PrintTheDocument(TheDocument theDocument)
{
} though there's no advantage to be had as you could simply call
theDocument.Print(); instead of
TheDocument.PrintTheDocument(theDocument); .
There is another common occaision when a static will create an instance, and this can be very useful. This is when creating a 'singleton[^]'.
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)
|
|
|
|
|
Since I got 2 replies already saying its "weird" to have static method like that, I changed it.
Now instead of simply calling TheDocument.Print(...); I first have to create instance oobject of it;
TheDocument doc = new TheDocument(TheList);
doc.Print();
And I already feel more confident that this is more "proper". Atleast with this approach I can in the future derive from IDisposable interface if I ever need, and this approach more easily yields to using . I guess.
For the sake of making it more readable to "end user of the class" should I consider using a property for "the list", like .WhateverThisListIs = TheList ?
|
|
|
|
|
It depends - not very helpful I know!
If they need array elemement level access then probably yes.
Imagine if your document was basically a header, body and footer - all strings. Something like this would be a good way of exposing it.
public class TheDocument
{
private string[] theData = new string[3];
public TheDocument()
: this(new string[] { string.Empty, string.Empty, string.Empty })
{ }
public TheDocument(string body)
: this(new string[] { string.Empty, body, string.Empty })
{ }
public TheDocument(string header, string body)
: this(new string[] { header, body, string.Empty })
{ }
public TheDocument(string header, string body, string footer)
: this(new string[] { header, body, footer })
{ }
private TheDocument(string[] data)
{
if (data.Length == 3)
theData = data;
else
throw new ArgumentOutOfRangeException("data", "Data must have a length of 3");
}
public static implicit operator TheDocument(string[] data)
{
return new TheDocument(data);
}
public static implicit operator string[](TheDocument theDocument)
{
return theDocument.theData;
}
public string Header
{
get { return theData[0]; }
set { theData[0] = value; }
}
public string Body
{
get { return theData[1]; }
set { theData[1] = value; }
}
public string Footer
{
get { return theData[2]; }
set { theData[2] = value; }
}
public void Print()
{
PrintTheDocument(this);
}
public static void PrintTheDocument(TheDocument theDocument)
{
}
}
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)
|
|
|
|
|
Why not a static class?
TheDocument.Print ( data )
|
|
|
|
|
hello all,
I created a custom Ribbon for word 2007 using VS 2008.
I have 4 editboxes on that ribbon in which user is going to enter some data.
I would like to attach this data to the same word file and save it, so that when i open this document i can see the contents with the user entered values in particular EditBoxes.
Can anyone suggest me how to do this ??????????
|
|
|
|
|
Hi,
I want nodes of tree view should behave like hyperlink. This I achieved by setting HotTracking property of tree view asTrue .
Now I want to change my Cursor as I hover over the Node text not the full row range.
Firstly:
I used NodeMouseHover event but cannot change the cursor to default.
Secondly:
private void treeView1_MouseMove(object sender, MouseEventArgs e)
{
if (treeView1.GetNodeAt(e.X, e.Y) == null)
treeView1.Cursor = Cursors.Default;
else
treeView1.Cursor = Cursors.Hand;
}
I used above TreeView MouseMove event. Using this I get default cursor when I hover over blank space of treeview but the cursor changes to hand when the pointer is not even over text and Node is not even underlined (using HotTracking).
Please help me to get cursor change only on text of Node.
|
|
|
|
|
Hi!!!
I am trying to display image from C and D drive using following code. The code is very simple. Here it is:
protected void Page_Load(object sender, EventArgs e)
{
Response.Write ("<table border='1'>");
Response.Write ("<tr>");
Response.Write ("<td><img src='D:\at.jpg'></td>");
Response.Write ("<td><img src='C:\try.jpg'></td>") ;
Response.Write ("</tr>" );
Response.Write("</table>");
}
I neither get image on page nor error message. How could i resolve it?Please guide me...
|
|
|
|
|
Well, there's a few issues here. 1 - you are in the wrong forum. 2 - your asp.net site cannot see above it's root. 3 - I believe your \a and \t will be interpreted as special characters. Put an @ in front of the string to avoid this. @"<img... etc=""
<div="" class="ForumSig">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.
|
|
|
|
|
try this:
protected void Page_Load(object sender, EventArgs e){
Response.Write (@"<table border='1'>");
Response.Write (@"<tr>");
Response.Write (@"<td><img src='D:\at.jpg'></td>");
Response.Write (@"<td><img src='C:\try.jpg'></td>") ;
Response.Write (@"</tr>" );
Response.Write(@"</table>");}
|
|
|
|
|
Thankyou Blikkies!!
Thankyou so much...
|
|
|
|
|
Blikkies's code will not work,it will not display images.
By the way you should post this question in ASP.NET forum.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.aktualiteti.com
|
|
|
|
|
But you have to take the images and paste it into your project, then the code should look like this:
protected void Page_Load(object sender, EventArgs e){
Response.Write (@"<table border='1'>");
Response.Write (@"<tr>");
Response.Write (@"<td><img src='at.jpg'></td>");
Response.Write (@"<td><img src='try.jpg'></td>") ;
Response.Write (@"</tr>" );
Response.Write(@"</table>");}
To able the client to see the images, the images should be in the Project folder.
|
|
|
|
|
One thing i want to ask...
I assign image path to some string variable like this:
string path = "C:\at.jpg'
and apply this:
protected void Page_Load(object sender, EventArgs e)
{
Response.Write(@"<table border='1'>");
Response.Write(@"<tr>");
Response.Write(@"<td><img src=path></td>");
Response.Write(@"<td><img src='D:\try.jpg'></td>");
Response.Write(@"</tr>");
Response.Write(@"</table>");
Then it does not display image neither it shows any error message. Why so?Please help..
|
|
|
|
|
One thing you must know,you CAN'T load image which is located outside project's folder,because this is ASP.NET,buy the way your image control is HTML Image and still this doesn't provide you possibility to load images as you are trying.
Why you don't create one folder inside your project and programmatically save images in that folder and then load it.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.aktualiteti.com
|
|
|
|
|
Because your image should be in the project, you cant attatch images that out side the project. I take it that you did window form before moving to asp, in a window application you can specify source of image like "C:\aaa.jpg" but in html or asp its different ex. let say all your files including asp and C# files is in "c:\inetpub\wwwroot\Myproject", you have to insert your image aaa.jpg into "c:\inetpub\wwwroot\Myproject" then your code should look like this
<img src="../aaa.jpg" />
Hope this help you.
|
|
|
|
|
You have to save image inside project folder,and insetad giving path to src property then just write name of image.
Response.Write ("<td><img src='at.jpg'></td>");<br />
Response.Write ("<td><img src='try.jpg'></td>") ;
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.aktualiteti.com
|
|
|
|
|
Also, for you to do this at all, is totally wrong. That's not what ASP.NET is for, it's better than that.
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.
|
|
|
|
|
I have an application with CrystalReports. The app works fine on the dev machine but fails on the production machine because of some Crystal .dll not loading. I have set Copy Local to true for all the crystal reference files therefore they are copied to the bin folder. I copy all files from the bin folder to the production machine but still fails. Any idea what else I should do?
CodingYoshi
Artificial Intelligence is no match for Human Stupidity.
|
|
|
|