|
Now i have changed the way i used the code.
Now i use my process.start code in Program.cs file.
But it is behaving in a different manner.
static void Main()
{
string appPath = applicationPath();
try
{
if (checkInternetConnection() == true)
{
if (setXML() == true)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Update());
}
else
{
Process.Start(appPath);
}
}
else
{
Process.Start(appPath);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
Process.Start(appPath);
}
appPath is the path of main application retrieved from applicationPath() method.
and setXml() is a method returning boolean value.
Now if update is available.
the application will fire Update Form else it will start my main app.
But instead the application runs , but its control and text are not visible.
When Update Form runs, Form is blank without any controls in it.
I m unable to understand what happens that my controls and heading form becomes invisible during runtime.
Can u sort out the problem?
Aspiring Techie,
Vishnu Nath
|
|
|
|
|
I can't see any reason here why the Update-form would hide it's controls, unless there's some kind of weird exception.
I wouldn't change the Program.cs, instead, I would have put the Process.Start code somewhere in the Update-form. Perhaps that any of the other members see a potential source of the error?
I are troll
|
|
|
|
|
Since i want either of the form to open. i.e either Update form if update is available or else my main app if there is no update.
Hence i chose it to include process.start code in program.cs file.
Aspiring Techie,
Vishnu Nath
|
|
|
|
|
Vishnu Nath wrote: Since i want either of the form to open.
The check might take a while, depending on connectivity. I'd still recommend showing a form with a message "Hold on, checking for new cool stuff!".
Alternatively, this worked for me;
Program.cs
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
if (true) <- perform update check here :)
{
System.Diagnostics.Process.Start("Calc.exe");
}
else
{
Application.Run(new Form1());
}
}
I are troll
|
|
|
|
|
Eddy Vluggen wrote: Update-form would hide it's controls
i got my mistake, i got the reason why Update form hided its control.
Its because by mistake i commented out the InitializeComponent() method in Update's constructor, that led to hiding of the controls in the form.
Aspiring Techie,
Vishnu Nath
|
|
|
|
|
we have done one project in windows application.we want give our software project to our clients.Now our problem is we have give Authentication premission four system or five system.
eg; we are giving software to one client,but they are taking our software for four or five system.
How to resit for four or five system .
thank's in adv
lavan
|
|
|
|
|
Hello All,
Ive got a difficulty regarding opening files in their respective editors...I have to develop an application where I need to say open a pdf file in AcrobatReader,doc file in Word,image in image editor...
Please do let me know if ne1 has solution to this....atleast reference to what i can do to solve this...
|
|
|
|
|
Each file-extension has a binding to a program that is used to open them. That's how the Windows Explorer knows that it should start "WordPad" for ".doc" files if you don't have Microsfot Word installed. Once Word is installed, it will use Word, as this gets associated with the file-extension during the installation.
If you just want to "open" the file with the correct editor, then you can simply use "Proces.Start" to start the document - it will open the document with whatever editor the user has associated with the file-extension.
If you want to display the editor-name in, say, a listbox, you'll have to dig deeper.
I are troll
|
|
|
|
|
bhagyashri.biyani wrote: I have to develop an application where I need to say open a pdf file in AcrobatReader,doc file in Word,image in image editor
Why do you have to develop that app when Windows Explorer already does that and comes free with Windows OS?
|
|
|
|
|
i need validations for textbox in my windows form .
pls help.
Swap
|
|
|
|
|
You will need to write your own code in the Validating event.
The word "politics" describes the process so well: "Poli" in Latin meaning "many" and "tics" meaning "bloodsucking creatures."
जय हिंद
|
|
|
|
|
|
Hi there,
I'm using the .NET 2.0 WebBrowser control in a windows form app, running on XP SP2.
Some of my users are getting the classic 'Access Denied' security exception when dropping into the Document_Completed event handler. I think the exception is happening when trying to access the .Document object of the WebBrowser control.
I know there are issues with frames, and cross domain requests using the WebBrowser control, but the website I'm hitting doesn't use frames and is on the local intranet. When the users try accessing the URL in a normal IE window, it loads fine. Must be something to do with the .Document object and user permissions?
The kicker is that some users are working fine on XP SP2, so I'm thinking it's permissions, any ideas?
Much appreciated,
thanks.
|
|
|
|
|
Hi,
scootrobertson wrote: Access Denied' security exception when dropping into the Document_Completed event handler
Don't stare at Exception.Message; instead look at the line numbers when you investigate Exception.ToString() and teach your IDE to always show line numbers (Visual Studio: Tools/Options/TextEditor/AllLanguages...), that way you will know exactly what line throws it.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
I've solved this now, and here's how I did it, if anyone else has similar issues...
I just added the following code to the OnLoad of the form, after the Navigate() call:
while (wbs.ReadyState != WebBrowserReadyState.Complete)
{
Application.DoEvents();
}
I also stopped initialising the browser control with 'about:blank', instead just navigating straight to my target page without going to 'about:blank' first.
I think what was happening is the DocumentCompleted handler was trying to access the wbs.Document property before it was initialised, if thats possible(!), and throwing an error. Weird thing was, this was just happening on some user's PCs, and not others.
Anyway, adding the while loop and removing the load of the about:blank first, seems to have fixed it.
scott.
|
|
|
|
|
hi,
i had made an windows application with a word document embedded in it.now i want to add a task pane inside the windows application.i tried this .
myUserControl1 = New UserControl1
objCustomTaskPanes = New CustomTaskPaneCollection
myCustomTaskPane = objCustomTaskPanes.Add(myUserControl1, "My Task Pane")
myCustomTaskPane.Visible = True
but this is not working ..please help
ash
|
|
|
|
|
hi i am using on windows form c# vs 2005 which i found to be very useful.
i was introduced Microsoft.Office.Interop.Excel after asking for advice in another post.
i am now trying to get the Microsoft.Office.Interop.Excel to instead of creating a new excel spreadsheet. but use an existing excel file which i drag into my workspace.
i also found
oXL.Workbooks.Open however i cant seem to be able to use it and i am not able to make it open the file in my workspace as well
anyone know how this can be done?
modified on Sunday, February 15, 2009 5:13 AM
|
|
|
|
|
neodeaths wrote: which i drag into my workspace
what do you mean by that ?
If you can state your exact difficulty someone can help you.See if this helps [^]
|
|
|
|
|
my difficulty now is that i cant seem to be able to open an existing xls file and edit the infomation.
also since the xls file is saved in my project workspace as i am trying to make it to a resouces path it in a way to use it
generally wat i am trying to achieve is to make my window form open a file form my project workspace and edit to info
|
|
|
|
|
If you have problems with finding the path, this might help you [^]
And since you would be editing you need to set the ReadOnly in Open call to false[^]
|
|
|
|
|
hi i am using visual studio 2005 c# windows form
what i am trying to do is to make my window form write a excel file with the data it have.
however i not sure what is the right procedure as i am tring to do it programmically.
i read a few articals about ado how ever they seem to show how excel is brought into the windows form
and not out.
|
|
|
|
|
This should get you going. You need to add a reference to Microsoft.Office.Interop.Excel
using Excel = Microsoft.Office.Interop.Excel;
OleDbCommand cmd;
using (OleDbConnection con = new OleDbConnection(string.Format("Data Source={0};" + "Provider=Microsoft.Jet.OLEDB.4.0;" + "Extended Properties=Excel 8.0;", fileName)))
{
con.Open();
string sqlToRun = "Create table [test] (Col1 int)";
string insert = "insert into [test](col1) values (100)";
cmd = new OleDbCommand(sqlToRun, con);
cmd.ExecuteNonQuery();
cmd = new OleDbCommand(insert, con);
cmd.ExecuteNonQuery();
}
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
|
I don't know on which forum i should post this, so i hope this is the right one since it has to do with windows forms projects..
The problem is the following, i have 2 simple projects (both windows application projects). Both the projects contain 1 form. In one of those forms i placed a button, if you press the button the form of the other project will open. (This is not my actual project, but a simplified version to recreate my problem)
Now i wish to publish my first project (the one with the form with the button), but visual studio keeps generating the following errors
A signing key is required in order to publish this project. Publishing from Visual Studio 2005 will automatically configure a signing key for this project.
and
Cannot publish because a project failed to build.
however, both projects build and run fine when debugging.
if i go to the properties, to the signing tab, and check "Sign the ClickOnce manifests", the same error keeps occuring.
Does anyone have any ideas how to solve this?
|
|
|
|
|
For signing, go to project Properties, Signing tab, and:
1. check Sign the assembly
2. select New for "Choose a strong name key file"
3. fill in the name of the key and psw
Calin
|
|
|
|