|
I need help on this.
In my project I have a folder called "files". Inside that folder I have many file which I have uploaded. Now ,just by writing the link of the files in the address bar of Web Browser (ex: http://localhost:1234/Server/files/file.rar) anyone can download that file. I want to change that. When the clients are writing the link, instead of downloading the file, another page will be opened (ex: continue.aspx) and by clicking a button on that page, they can download that file (the story is like in rapidshare, filefactory, megaupload ...)
Can anyone tell how this can be done.
|
|
|
|
|
I would recommend asking in the ASP.NET forum.
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 )
|
|
|
|
|
Hello
I'm trying to set the focus to a DGV and move the mouse to that DGV
But the position seems to be related to the screen area not the active form area
Thanks for any help
Here is the code I'm using
[CODE] private void HandMade_Click(object sender, EventArgs e)
{
dgv_X.Focus();
int X = dgv_X.Left + dgv_X.Width / 2;
int Y = dgv_X.Top + dgv_X.Height ;
Cursor.Position = new Point(X, Y);
}[/CODE]
|
|
|
|
|
Assuming you are using a TextBox control, try useing the control's SelectionStart and SelectionLength properties
EG:
textBox1.SelectionStart = 4;
textBox1.SelectionLength = 0;
sets the cursor to the fourth char in the text box
|
|
|
|
|
Thank you
But this is not the solution
First I'm trying to set cursor on a DGV (as explained), not a textbox
Two : the problem was to set the cursor position to that control
Here is the working code :
First : I compute the point P to get to position relative to the form
Second : I translate this point to Screen coordinate relative to the form position using PointToScreen
private void HandMade_Click(object sender, EventArgs e)
{
dgv_X.Focus();
int X = dgv_X.Left + dgv_X.Width / 4;
int Y = dgv_X.Top + dgv_X.Height / 2;
Point P = new Point(X, Y);
Cursor.Position = this.PointToScreen(P);
}
|
|
|
|
|
hi
i want to beginning programming with usb via c# .net, is there any helpFul book about this subJect ?
(wrox,apress or .... )?
thanks
|
|
|
|
|
I don't think it's the subject of an entire book, but I think there are some good articles online on the topic.
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 am using Reportviewer with localreport choice in webforms. I test the query passed to reportviweer and it return results immediately. But when requesting in Web it take about 30 minutes. Also exporting to pdf need even more time. Have somebody any suggestion for me? Which parts are important for increasing speed?
With best Reagrds
Regards Amir Jalaly
|
|
|
|
|
Hi all!
I am creating a simple user control which renders text within its paint event handler. Under some circumstances (when the output rectangle is very small) the exception "The object is already in use elsewhere." occurs...Which does not make any sense because a) the program is not multithreaded and b) it isn't particuarly complex. This crashing began when I started using the TextFormatFlags.ModifyString flag, and the problem is likewise immediately cured by removing this flag.
Am I using the flag in an incorrect fashion? The itemLabel string is actually updated correctly (end ellipsis is added when displayed).
string itemLabel = new string(item.Label.ToCharArray());
TextRenderer.DrawText(ctx.Graphics, itemLabel, activeFont, Rectangle.Round(extraLabelBounds), textColour, backgroundColor, TextFormatFlags.EndEllipsis | TextFormatFlags.ModifyString);
If this is a problem, is it possible to get the EndEllipsis version of the string based upon the graphics context, font, output rectangle bounds, and text?
Many thanks!
Lea Hayes
|
|
|
|
|
What is the class of the exception that you are getting? That might help to determine what it is that is used elsewhere...
Where do you get the Graphics and Font objects from?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi,
The exception class is System.InvalidOperationException . The Graphics class is as provided by the paint event handler (this is the overriden method protected override void OnPaint(PaintEventArgs e) ).
The font object is generated by:
Font activeFont = SystemFonts.DefaultFont;
if(series of conditions)
activeFont = new Font(activeFont, FontStyle.Bold); Here is the exception information:
System.InvalidOperationException was unhandled
Message="Object is currently in use elsewhere."
Source="System.Drawing"
StackTrace:
at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
at System.Drawing.Graphics.DrawLine(Pen pen, Single x1, Single y1, Single x2, Single y2)
Whilst the above suggests that the problem is related to the 'DrawLine' method, just simply removing the 'TextFormatFlags.ModifyString' flag prevents the crash from occurring.
For my particular application all I needed was a boolean value which indicates whether the output text was truncated or not. Whilst I have found a workaround for this (listed below), I am still interested to find out why this exception is being thrown...I have double-checked my code and I cannot understand how the objects are being used elsewhere because they are pretty much created each time the paint event is handled. The only things which are in common are the data item and the user control itself.
if (extraLabelBounds.Width > 0)
TextRenderer.DrawText(ctx.Graphics, itemLabel, activeFont, Rectangle.Round(extraLabelBounds), textColour, backgroundColor, TextFormatFlags.EndEllipsis);
Size measuredA = TextRenderer.MeasureText(ctx.Graphics, itemLabel, activeFont);
Size measuredB = TextRenderer.MeasureText(ctx.Graphics, itemLabel, activeFont, Size.Round(extraLabelBounds.Size), TextFormatFlags.EndEllipsis);
bool hasOverflown = !measuredA.Equals(measuredB);
Thanks,
Lea Hayes
|
|
|
|
|
Hello, I made a program in C# with a webrowser that loads a website. the website unfortunately has flash ads.
is it possible to block flash? or maybe stop the WebBrowser1 from loading <embed> tags? maybe change the embed tag to a div tag so that it doesnt show? how would i go about doing this? any help is appreciated. thanks
if it is too much to ask, i would appreciate some code? i already tried google with no success
|
|
|
|
|
Perhaps you could modify the control's content after it's loaded the document? See:/ravi
|
|
|
|
|
|
Well, your main form will need to be an MDI parent, and then you need to add the forms as mdi children. That means that the child forms will be contained within the main form.
You can then use the paint event of your main form to draw the lines between the child forms.
MDI stuff[^] and in the paint event you use e.Graphics to draw from, the graphics class contains methods for drawing lines, rectangles, circles etc. its fairly straight forward.
My current favourite word is: I'm starting to run out of fav. words!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
Depending on how you have your forms layed out (either MDI or just many forms on the desktop), you could use the ControlPaint.DrawReversibleLine(...) to draw outside the border of the forms.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
|
.Substring ?
haripinna wrote: pick a single letter and the position from that string
if you mean "and get the position", then try .IndexOf
modified on Saturday, May 17, 2008 11:16 AM
|
|
|
|
|
Thanks for giving response.
i can't get you..
please provide code for that..
Thnaks,
Pinna
Pinna
|
|
|
|
|
Did you search for Substring? It's a method which you can use on any string - look in MSDN
TextBox1.Text.Substring(i, l);
will retrieve the number of characters specified by l from the position specified by i .
Dave
|
|
|
|
|
Or Use .CharAt
Thanks
"Good Thing Goes With Good People..."
|
|
|
|
|
Not sure what you mean by "pick". If you mean "find", see the IndexOf() [^] method.
/ravi
|
|
|
|
|
Hi, I have several servers which have an Intel Pro network adapter with several vlans. I am attempting to write a C# application to modify the vlan id and vlan name for a single adapter. I've been able to query the id's and names via WMI, however when i attempt to use a PUT() (update only) i receive a generic error. Reading the documentation it says i need to do a putinstance() for those values. I've managed to find a C++ version of PutInstance() but nothing for C#. Any assistance on how i can do this with native C# classes? Thanks!
|
|
|
|
|
Maybe this[^] helps.
SkyWalker
|
|
|
|