|
Simple way to run Exe is.
Process process = new Process();
process.StartInfo.FileName = "notepad.exe";
process.Start();
thats all i know.
Thanks
"Good Thing Goes With Good People..."
|
|
|
|
|
Well i was working on a very simple project , In windows application form1 i want set a password to modify, there are two buttons in the form which can be activated if user enters correct password.
Notice forms controls are: label, textbox1, button1 and button2.
who can send me code snippet for above would be great indeed!
thanks pls help me!!
so much of happy ending...
|
|
|
|
|
Have you made an attempt to solve the problem yourself?
This site is for people who want to learn, not for people who want their (home)work done for them.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Hi.
I have the follow:
1. System.Data.DataTable dt = new System.Data.DataTable();
2. dt = dal.Search(findfile.Text); // I receive the data correctly
3. dt.WriteXML(YourSearch);// I'm trying to create a xml file from the datatable
4. Response.TransmitFile(YourSearch);//download xml file
In the thirth row, when i run (compile ok) I receive
"Cannot serialize the DataTable. DataTable name is not set"
What that mean?
thanks.
|
|
|
|
|
It means what it says. Set the TableName property for your DataTable.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Hi, I'am have similar problem,but I resolved it
the trick is set the TableName between DataTable is transmited and DataTable is received have a same name
|
|
|
|
|
hi, i want to change system language (language bar) to second language(FA) while one of my textbox in the form has the focus.and again back to normal (EN) when going to next textbox.
so how can i do that?
|
|
|
|
|
solved mostly: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2423864&SiteID=1&mode=1
I have this functionality i want to port from WinForms but i run into a few problems and i can't continue. What it does is move a panel(canvas) around as i click and hold and drag the mouse). I saw the sample using TranlateTransform(XAML) but i can't get any code-behind example, this is dynamic and interactive. I managed to make some out only need the translation solved(and possibly a good approach on using this with Margin, wich seems the only tool i got to moving the canvas around?).
Code Block#region Pan tool
private bool mMovingPanel;
private Point mMousePos;
private void panel1_MouseDown(object sender, MouseEventArgs e)
{
mMovingPanel = e.Button == MouseButtons.Left;
// prev mouse pos
mMousePos = panel1.PointToScreen(e.Location);
}
private void panel1_MouseMove(object sender, MouseEventArgs e)
{
if (mMovingPanel)
{
// "this mouse pos"
Point pos = panel1.PointToScreen(e.Location);
// "this mouse pos" - "prev mouse pos" = offset
Size adj = new Size(pos.X - mMousePos.X, pos.Y - mMousePos.Y);
// Location + offset = Location (final - unassigned)
Point loc = panel1.Location + adj;
if (panel1.Width >= this.ClientSize.Width && panel1.Height >= this.ClientSize.Height)
{
if (loc.X > 0) loc.X = 0;
if (loc.X + panel1.Width < this.ClientSize.Width) loc.X = this.ClientSize.Width - panel1.Width;
if (loc.Y > 0) loc.Y = 0;
if (loc.Y + panel1.Height < this.ClientSize.Height) loc.Y = this.ClientSize.Height - panel1.Height;
}
else if (panel1.Height >= this.ClientSize.Height)
{
if (loc.X < 0) loc.X = 0;
if (loc.X + panel1.Width > this.ClientSize.Width) loc.X = this.ClientSize.Width - panel1.Width;
if (loc.Y > 0) loc.Y = 0;
if (loc.Y + panel1.Height < this.ClientSize.Height) loc.Y = this.ClientSize.Height - panel1.Height;
}
else
{
if (loc.X < 0) loc.X = 0;
if (loc.X + panel1.Width > this.ClientSize.Width) loc.X = this.ClientSize.Width - panel1.Width;
if (loc.Y < 0) loc.Y = 0;
if (loc.Y + panel1.Height > this.ClientSize.Height) loc.Y = this.ClientSize.Height - panel1.Height;
}
// Location(final - assigned)
panel1.Location = loc;
// "this mouse pos" set aside as "prev mouse pos"
mMousePos = pos;
}
}
private void panel1_MouseUp(object sender, MouseEventArgs e)
{
mMovingPanel = false;
}
#endregion
This is my attempt, i know it lacks but hopefully it will speed things up:
Code Block#region Pan tool
private bool mMovingPanel;
private Point mMousePos;
private void panel1_MouseDown(object sender, MouseEventArgs e)
{
mMovingPanel = Mouse.LeftButton == MouseButtonState.Pressed;
// prev mouse pos
mMousePos = canvas1.PointToScreen(Mouse.GetPosition(canvas1));
}
private void panel1_MouseMove(object sender, MouseEventArgs e)
{
if (mMovingPanel)
{
// "this mouse pos"
Point pos = canvas1.PointToScreen(Mouse.GetPosition(canvas1));
// "this mouse pos" - "prev mouse pos" = offset
Vector adj = new Vector(pos.X - mMousePos.X, pos.Y - mMousePos.Y);
// Location + offset = Location (final - unassigned)
Thickness currentThickness = new Thickness();
Thickness loc = new Thickness(currentThickness.Left + adj.X, currentThickness.Top + adj.Y,
currentThickness.Right, currentThickness.Bottom);
if (canvas1.ActualWidth >= this.ActualWidth && canvas1.ActualHeight >= this.ActualHeight)
{
if (loc.Left > 0) loc.Left = 0;
if (loc.Left + canvas1.ActualWidth < this.ActualWidth) loc.Left = this.ActualWidth - canvas1.ActualWidth;
if (loc.Top > 0) loc.Top = 0;
if (loc.Top + canvas1.ActualHeight < this.ActualHeight) loc.Top = this.ActualHeight - canvas1.ActualHeight;
}
else if (canvas1.ActualHeight >= this.ActualHeight)
{
if (loc.Left < 0) loc.Left = 0;
if (loc.Left + canvas1.ActualWidth > this.ActualWidth) loc.Left = this.ActualWidth - canvas1.ActualWidth;
if (loc.Top > 0) loc.Top = 0;
if (loc.Top + canvas1.ActualHeight < this.ActualHeight) loc.Top = this.ActualHeight - canvas1.ActualHeight;
}
else
{
if (loc.Left < 0) loc.Left = 0;
if (loc.Left + canvas1.ActualWidth > this.ActualWidth) loc.Left = this.ActualWidth - canvas1.ActualWidth;
if (loc.Top < 0) loc.Top = 0;
if (loc.Top + canvas1.ActualHeight > this.ActualHeight) loc.Top = this.ActualHeight - canvas1.ActualHeight;
}
// Location(final - assigned)
canvas1.Margin = loc;
// "this mouse pos" set aside as "prev mouse pos"
mMousePos = pos;
}
}
private void panel1_MouseUp(object sender, MouseEventArgs e)
{
mMovingPanel = false;
}
#endregion
-- modified at 1:04 Monday 19th November, 2007
|
|
|
|
|
I like C# but its useless in my applications because I can not protect my source code as its always included in deliverables.
Is there any real solution coming for this in near future or should I just give up C# .NET.
I believe this should be major concern for many but I haven's see Microsoft taking any role for this.
|
|
|
|
|
triag wrote: I can not protect my source code
No.. You don't need to give your sourcecode to your client.. After making the setup file, there won't be any sourcecode in your setup file..
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
"Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."
|
|
|
|
|
I tried this by making simple windows forms application and publish it. I select The application is available offline as well.
It generated setup.exe and subdirectory Application files. Under that there is file application.exe.deploy
I renamed that to be application.exe and open it Lutz Roeder's reflector. It was able to re-generate my source code from that. I think my clients can do same.
|
|
|
|
|
No. The generated code won't be the same as the original code that you wrote..
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
"Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."
|
|
|
|
|
Atleast all of my business logic is there in very clear form.
I don't really feel confident. Reverse-engineering or hacking is other thing as this is way too easy to steal the hard work.
|
|
|
|
|
You would need to look at using an obfuscator[^] to make it more difficult to reverse-engineer the source code for your application.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
|
Hello friends i want to know
how do i set source of the datagrid at runtime
if possible can u send me the code of it.
|
|
|
|
|
Let's say "DataGrid1" is the name of your DataGrid. "ds" is the name of DataSet that you have filled your data.. so, you can put this code below in your Page_Load()
<br />
DataGrid1.DataSource = ds.Table[0];<br />
DataGrid1.DataBound();
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
"Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."
|
|
|
|
|
Hello,
I have created a C# project with two different languages (english and Spanish), and I would like to determine, OUTSIDE of the project that uses the language DLLs, what type of language the DLL contains.
In C++ you could set the language of the DLL and right click on it and see for instance: "Spanish (Mexico)"
[[ From explorer right click on DLL and select properties,
click on the Version tab, in the 'other version information'
click on Language ]]
In C#, my language DLLs all have "Language Neutral"
[[same thing right click ...]]
Which leads me to the following questions:
1. Is it possible to set the "language" property of a C# resource DLL?
2. Can I get the language "property" of a C# resource DLL programatically?
Thanks
|
|
|
|
|
I think this is defined in Project -> Properties -> Application tab
there you have an 'Assembly Information' button next to "Output Type", and there is a place where you select neutral language.
Now, I have no idea what that actually does change, but that would be the info you'd see when you check the properties of the DLL I assume.
regards
|
|
|
|
|
Thanks - not quite...
That just sets the "default" language for the application:
[assembly: NeutralResourcesLanguageAttribute("en-US")]
What I am looking for is the same thing for resource DLLs, but I don't think it exists...
Right click on a C++ DLL, select properties, select Version tab, click on Language in the 'other version information' group box
|
|
|
|
|
Hello, and thanks for taking the time to read me...
I am starting with Visual C# to build a Windows application, although I have long experience with Web design in PHP, Javascript, XML/XSL...
I am trying to build a program that would use data from an XML Database file, locally, with online updates.
The program needs to be able to run offline, but check for updates on the XML file when online.
So I have several questions:
- First, I'd like to understand how program updates work: Is there a standard protocol in Visual C# that looks for application updates? Or do I need to program that?
If so, I assume it looks for update of the .EXE, or how would it handle external files?
- So then, I was thinking it may be easier to embed the 'local' XML into the program, and hide it from the user, but I don't see an easy way to use my XML directly. It seems like no matter what I do, I should 'load' the XML into a dataset, which to me sounds absurd since Visual C# is supposed to handle XML in native. After all XML is a structured object, so why can't I access it directly? (or if I can, please tell me how!!!)
The idea behind using XML is that most of my data is formatted text that I later need to output in the form of Word or PDF documents, so it seems obvious to store the data in XML and use XSL:FO transforms on the data to output in the format I want in the end.
I also find a little odd that Visual C# would only handle formatted text as RTF, and not HTML or XML with XSL, but RTF is easy enough to transform in XML, so I'll deal with that... unless someone knows of controls designed to handle HTML/XML editing easily (and that won't cost me a fortune!)
Any insight would be very welcome!
Thanks!
|
|
|
|
|
You may want to look at the ClickOnce API for updating your app. http://msdn2.microsoft.com/en-us/library/t71a733d(VS.80).aspx[^]
You can retrieve the XML and load it into an XmlDocument. Then you can access it using XPath expressions, or iterator over nodes, or however you need to.
only two letters away from being an asset
|
|
|
|
|
Thanks for the tip on ClickOnce.. .that seems ot be what I need to look into.
Now, I see I can load my files into an XmlDocument, and then do whatever with it. Is there a way to actually embed an XML file onto the program?
It seems like I can load a new 'Item' to my project... but then what how do I access it? Do I still have to 'link' or 'load' it as a xml.document?
I have to admit I am a little lost with all the different 'items'
|
|
|
|
|
|
Hello,
Simple problem but its causing me grief.
I want to consume an RSS feed and display a varying amount of stories on different web pages.
If I retrieve the xml document and then use xpath to drill down to the items I get a nodelist like so:
XmlNodeList nl = rssDoc.SelectNodes("rss/channel/item");
Now, what is the best way (if this list contains say 30 stories) to convert it to a node list of say 3 stories?
I appreciate this is probably either:
a. 2 lines of code
b. not possible.
Help please?
|
|
|
|