|
Yeah. It's in C#. Here is the URL.
But only one thing. there are too much of coding in it..
|
|
|
|
|
I do not see any URL, please send me again.
|
|
|
|
|
Did you move your mouse over the word "here"
Okay anyways.. here goes http://www.icsharpcode.net/OpenSource/SD/
|
|
|
|
|
My C# winforms app allows users to create documents. Embedded in a document is any author meta-data the author wanted to share, such as their website URL. Then, other users who open their document can click the URL entered by the author to have their browser opened to that page. My concern is that a malicious user, instead of entering his homepage into the URL field, will enter some kind of crazy URL that includes scripting code or some other internet exploit, which will do something bad to an unsuspecting user who clicks on that URL (sorry I'm not being more technical, but I don't really know how all these exploits work).
My question is this: Are there any specific characters or other junk that my C# app should filter out from a URL before sending it to the browser?
Thanks for the help!
|
|
|
|
|
You can regular expression for checking whether it's valid URL or not in your C# application.
here is the one that I google for you..
|
|
|
|
|
There's not really any point in trying to protect users from code in the url, as long as you are letting them link to a page of their own. They can put anything on the page they are linking to, and you can't check it. Of course you can check the url, but don't fool yourself (and your visitors) that it's safe just because the url itself doesn't contain anything harmful.
If you are afraid of malicious users, you should warn anyone that is clicking on a link that you don't have full control over, that they are moving to a page that might contain something harmful (or offensive, or illegal...).
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi,
i'm having a problem how to get a control from form 1 to form 2..for example:
i want gridview name dgvBlaBla from form1 can be access from form 2 ?_?
Can Anyone Help Me..I'm sorry i'm beginner in C#
Regard,
TCim
|
|
|
|
|
#1. Lets say there are two forms (form1, form2) in your application. you put one button called button1 in form2. You wanna get the control (button1) of form2 from form1.
Add one public property which is returned the control that you required in form2
eg:
<br />
public Button Button1<br />
{<br />
get<br />
{<br />
return button1;<br />
}<br />
}<br />
Then, you can access this control from form1.
eg:
<br />
Form2 obj = new Form2();<br />
MessageBox.Show(obj.Button1.Text);<br />
There are another way to get the control from other form or assembles. I'm not gonna mention here. If you are interest about this, please "Reflection" class from MSDN or google.
Hope it helps.
|
|
|
|
|
Thank You
It Helps Me solve My problem
Regard,
Tomi
|
|
|
|
|
You've got an answer already, but I'm asking myself why you want to do this? because I think there is a bit of a design problem here (information hiding? encapsulation?)
-^-^-^-^-^-
no risk no funk
|
|
|
|
|
I have to write the event handler for MSCOMM.OnComm who is listening to serial port for data, so that the event is fired 'OnComm' is executed when the data is arrived.
My understanding for the documentation is unclear as how to achieve this.
Does any one have the sample source code implementation in C# / C++?
Thanks and Regards.
Amar.
|
|
|
|
|
If you're using .NET 2.0 (Visual Studio 2005), why are you even bothering with the MSCOMM control? There's a SerialPort class built into the .NET Framework under the System.Io.Ports namespace.
|
|
|
|
|
Hello,
Trying to write an app that I can work with dual monitors and Windows windows...
I'd like to add buttons next to the minimize button for all windows within Windows. Can anyone point me in the right direction on this?
Thanks!
Andy
|
|
|
|
|
This peace of code will draw a button on title bar , however i don't like to write C# code
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
If m.Msg = WM.NCPAINT Then
Me.DefWndProc(m)
Dim G As Graphics = Graphics.FromHdcInternal(GetWindowDC(Me.Handle))
Windows.Forms.ButtonRenderer.DrawButton(G, New Rectangle(Me.Width - 100, 5, 20, 20), VisualStyles.PushButtonState.Normal)
Else
MyBase.WndProc(m)
End If
End Sub
Other APIs you may use : GetSystemMetrics , GetWindowLong(HWND , GWL_STYLE) , GetWindowInfo -> to determine the size of window's border , to count title button ...
|
|
|
|
|
I want to display the properties of (.swf , .fla) files as height, width and resolution.
|
|
|
|
|
Hi,
Here's the code:
foreach (DataRow dr in myWebLoggerDataSet.MonitorList.Rows)
{
string name = dr["Name"].ToString();
string size = dr["FileSize"].ToString();
string colour = dr["Colour"].ToString();
string display = name +" : " +size;
string[] myItems = new string[]
{
display
};
ListViewItem lvi = new ListViewItem(myItems);
lvi.BackColor = Color.FromArgb(Convert.ToInt32(colour));
this.lvResourceMonitor.Items.Add(lvi);
}
The problem I have is that the item background color is used when debugging in W2K3 server but not when running normally on a Win XP machine. I need to manually select each item in XP to get the highlight color to take effect.
I've tried various options like redraw, giving the listview focus etc but to no effect.
Any suggestions for fixing this very frustrating issue?
Thanks.
-- modified at 5:42 Saturday 14th July, 2007
It happens on W2K3 as well. Works fine in debug mode though.
Glen Harvy
|
|
|
|
|
Hey Glen,
I can't get the same behaviour on my machine... it just works as expected when I try.
Have you suspended any of the drawing methods on the control to improve performance or anything like that? Have you got any other code setting properties on the listview? Have you tried invalidating the form?
|
|
|
|
|
Thanks for you response. I really need someone to talk to - I'm going nuts.
I haven't done anything that I can tell would make the listview behave differently between when run in debug mode versus production mode.
I have also tried lv.refresh, lv.update lv.invalidate various lv.focus etc but all to no efect. I have discovered at least three different ways to change the background color that all work in debug but not production mode.
This is the only instance of this error that I have had so I find it difficult to believe it's my computer at fault.
Could you try this for me please - set the listview to "Details" and see if that makes a difference.
Thanks.
Glen Harvy
|
|
|
|
|
I've just tried all the possible modes, and it they all work like they should - with no need to invalidate, refresh or whatever.
Here's an idea, just so you can see if it works outside of your current project. Create a new WinForms project and put a button and a listview on the form.
In the list view manually add three columns - the names don't matter very much Col1, Col2, Col3 should be fine. Also, switch the grid to details mode.
Place this code in button1's click event:
<br />
private void button1_Click(object sender, EventArgs e)<br />
{<br />
for (int g = 0; g < 10; g++)<br />
{<br />
string[] namesArray = new string[3] { "Martin", "Was", "Here" };<br />
<br />
for (int i = 0; i < namesArray.Length; i++)<br />
{<br />
ListViewItem lvi = new ListViewItem(namesArray[0]);<br />
lvi.SubItems.Add(namesArray[1]);<br />
lvi.SubItems.Add(namesArray[2]);<br />
<br />
lvi.BackColor = Color.FromArgb(Convert.ToInt32("58996"));<br />
listView1.Items.Add(lvi);<br />
}<br />
} <br />
}<br />
When you run the program (I've done it from both Debug and Release folders), hopefully you'll get something like this?
http://img261.imageshack.us/img261/4448/listviewin4.jpg[^]
|
|
|
|
|
I thank you for your time and effort - the fact that it worked for you got me thinking. So this is what I did:
1. Created a new project2 and copied most of the code from project1 in question to a new listview. Everything worked fine so that eliminated my computer. Must be the code somewhere.
2. Went back to my original project1 and commented out the foreach .. loop and copied the code from project2 and it still didn't work.
3. The code worked on project2 - so why not project1.
4. Quadruple checked all the configuration of the two listviews in 1 and 2. I swear they were the same.
5. OK. Create new listview in project1 alongside of the original and used the same code as in project2. - New listview worked. Old listview no good - new listview OK.
6. Used new code (modified) to fill new listview from the table. New listview still works fine with new data.
7. Dragged old listview to vacant part of screen and moved new listview to old listview position. In this action I did something that created an event on new listview. No worries - just deleted the event from the new listview.
8. Now BOTH listviews are working as they should be.
I'll swear I didn't change anything on the old listview.
It's 1:05 am here so I'm going to bed. I am going to get a copy of the backup code tomorrow and compare the two designer code sections - there's gotta be something in there that caused this.
There is one other thing. The new listview was outside of a group box but having "swaped" the two listviews, the problem has not returned.
For the record - here's the code that now works for BOTH listviews:
int i = 0;
foreach (DataRow dr in myWebLoggerDataSet.MonitorList.Rows)
{
string name = dr["Name"].ToString();
string size = dr["FileSize"].ToString();
string colour = dr["Colour"].ToString();
string display = name + " : " + size;
string[] myItems = new string[]
{
display
};
string test = "Bozo";
//ListViewItem lvi = new ListViewItem(myItems); //,0,Color.Black, Color.Pink,Font);
////lvi.UseItemStyleForSubItems = true;
////lvi.BackColor = Color.FromArgb(Convert.ToInt32(colour));
//this.lvResourceMonitor.Items.Add(lvi);
//lvi.BackColor = Color.FromArgb(Convert.ToInt32(colour));
//lvResourceMonitor.Refresh();
this.lvResourceMonitor.Items.Add(display);
this.lvResourceMonitor.Items[i].BackColor = Color.Chartreuse;
this.lvResourceMonitor.Refresh();
lv1.Items.Add(display);
lv1.Items[i].BackColor = Color.FromArgb(Convert.ToInt32(colour));
lv1.Refresh();
i++;
}
The ListviewItem array lvi was not the cause of the problem as far as I can tell. I'm pretty sure of this because I used the new code to fill the old listview without success.
I'm off to bed - once again - thanks for helping me.
Regards,
Glen Harvy
|
|
|
|
|
No problem - things like that frustrate the hell out of me when they happen, so it's good to lend at least a sympathetic ear when it happens to others!
Cheers,
Martin.
|
|
|
|
|
Hi everybody,
I'm currently designing a GUI hierarchy comparable to the Winforms one in XNA, so I have something like this:
class Control
class Form : Control
class Button : Control
and methods like this (that's how .NET does it, I copied it for my own GUI):
protected virtual void OnMouseDown(MouseEventArgs e)
{
mouseDown = true;
}
protected virtual void OnMouseUp(MouseEventArgs e)
{
mouseDown = false;
}
Now I have a controller which traverses the z-order and notifies the control in question that it just got a MouseDown or MouseUp event.
It looks like that:
List<Control> controls = new List<Control>();
void MouseInput_MouseUp(MouseEventArgs e)
{
for (int i = controls.Count - 1; i >= 0; i--)
controls[i].OnMouseUp(e);
}
But I can't call OnMouseUp because it is protected, so how do I tell the control?
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi,
the way I understood it, keyboard and mouse input basically go to the app, Application.Run(new Form1()) make them go to your instance of Form1, and from there they get dispatched
to the Form and its content (thru Controls property).
BTW: there is a free implementation of .NET available under ssCLI or shared source CLI.
Google will locate it for yoi.
Hope this helps.
|
|
|
|
|
Luc Pattyn wrote: the way I understood it, keyboard and mouse input basically go to the app, Application.Run(new Form1()) make them go to your instance of Form1, and from there they get dispatched to the Form and its content (thru Controls property).
Do you have any source where this behaviour is described?
Luc Pattyn wrote: BTW: there is a free implementation of .NET available under ssCLI or shared source CLI.
You mean Mono? I will check out their source. I'd still love some explanation what's really on with those OnXXXMethods
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|