The Wayback Machine - https://web.archive.org/web/20090217131443/http://www.codeproject.com:80/script/Forums/View.aspx?fid=387161
Click here to Skip to main content
5,896,359 members and growing! (18,270 online)
Announcements
* Bold indicates new messages since 3:14 17 Feb '09




BullFrog Power
Advanced Search
Sitemap

Windows Forms


Home > Forums > Windows Forms

 Msgs 1 to 25 of 458 (Total in Forum: 4,026) (Refresh)FirstPrevNext
QuestionRadio Buttons in a MenuStripmemberDavidM1003:05 16 Feb '09  
As the ToolStripMenuItem class does not provide an option for displaying radio buttons next to menu items (like RadioCheck in the old MenuItem class), Microsoft recommends using the RadioButtonRenderer class:

http://msdn.microsoft.com/en-us/library/ms404318(VS.80).aspx[^]

However, this is how the menu radio button looks in the compiled sample on Windows Vista:

http://img25.imageshack.us/img25/6205/radiobuttonrenderernz4.gif[^]

And this is how a default menu radio button looks like in Windows Vista Explorer:

http://img3.imageshack.us/img3/2917/defaultmenuradiobuttonft1.gif[^]

How can I display this default radio button on a ToolStripMenuItem using C# and WinForms?

Thank you,
David
QuestionWebBrowser control on XP SP2 - permissions?memberscootrobertson0:39 16 Feb '09  
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.
Questioncustom task pane in windows applicationmemberaashishkrishnan19:46 15 Feb '09  
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
Questioncan Microsoft.Office.Interop.Excel use a existing excel template? [modified]memberneodeaths22:43 14 Feb '09  
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

AnswerRe: can Microsoft.Office.Interop.Excel use a existing excel template?memberABitSmart1:07 15 Feb '09  
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 [^]
QuestionRe: can Microsoft.Office.Interop.Excel use a existing excel template?memberneodeaths1:10 15 Feb '09  
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
AnswerRe: can Microsoft.Office.Interop.Excel use a existing excel template?memberABitSmart1:21 15 Feb '09  
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[^]
Questionneed advice on using window form to generate excel datamemberneodeaths1:21 13 Feb '09  
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.
AnswerRe: need advice on using window form to generate excel datamvpAshfield2:35 13 Feb '09  
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); // create table (worksheet)
cmd.ExecuteNonQuery();

cmd = new OleDbCommand(insert, con); // insert record
cmd.ExecuteNonQuery();
}


Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP

AnswerRe: need advice on using window form to generate excel datamemberABitSmart2:36 13 Feb '09  
Use can either use ADO[^] Or Interop.Excel[^][^]

MSDN Support[^] / Google[^]
QuestionClickOnce problem: 1 solutionfile, 2 windows forms projectsmembermSh198522:56 12 Feb '09  
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?
AnswerRe: ClickOnce problem: 1 solutionfile, 2 windows forms projectsmemberCalin Tatar23:11 12 Feb '09  
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
GeneralRe: ClickOnce problem: 1 solutionfile, 2 windows forms projectsmembermSh198523:17 12 Feb '09  
thanks for the quick reply.
But signing the assembly (for both projects) doesn't seem to solve the problem. the same error occures.
I tried adding test certificates to both projects, now i get an error that the manifest file can not be found...

ps: i'm using visual studio 2005
QuestionHow to close specific windows application when Computer is turned off or is restarted .memberVishnu Nath2:23 12 Feb '09  
I have developed a windows application in C#.net that is running in the background like an antivirus.
But the problem is whenever i try to switch off my computer or try to restart my computer, the computer doesn't turns off/restarts.
And when i individually kills that windows(.exe) application listed out in Processes tab in Windows Task Manager and then tries to switch off the computer or restart it, Everything seems to be fine. How could i enhance or optimize my code so that whenever computer is turned off or is restarted, my application process should be killed automatically. Is there any class in .Net that could possibly find out , when computer is switched off or is restarted, so that i could kill down my application process at that time.
Anyone who could help me out in fixing the bug.
Thanks in Advance!! Sniff

Aspiring Techie,
Vishnu Nath


AnswerRe: How to close specific windows application when Computer is turned off or is restarted . [modified]memberAlan N5:25 12 Feb '09  
When Windows wants to shut down it attempts to close all running applications cooperatively and your app must have refused that close request.

Have you coded a FormClosing event handler to stop the application closing?

e.g.
    private void Form1_FormClosing(object sender, FormClosingEventArgs e) {
e.Cancel = true;
}


The good news is that you can fix it.

Take a look at the FormClosingEventArgs.CloseReason Property and code something like this.


    private void Form1_FormClosing(object sender, FormClosingEventArgs e) {
if (e.CloseReason == CloseReason.WindowsShutDown) {
e.Cancel = false;
} else {
e.Cancel = true;
}
}


Alan.

modified on Thursday, February 12, 2009 11:17 AM

GeneralRe: How to close specific windows application when Computer is turned off or is restarted .memberVishnu Nath23:16 12 Feb '09  
You are right Alan.
I have coded the same way as u have mentioned, to keep my apps running in the background.
Now i will change the code to your mentioned code.
Thanks for the solution.
Anyways is there any method where i can start my application and put the notification icon in system tray silently in the background, whenever computer is switched on or is restarted. It is similar to Gtalk or anti- virus starting their application whenever computer is turned on or is restarted.
And also Alan, i want my application to behave like system process, so that
no one could possibly kill that process from windows task manager processes list, except when computer is switched off. I have seen that you can cannot kill anti-virus processes from windows task manager.
How do one convert their application into system processes ensuring that the application could not be killed by administrator of computer(except when comp is switched off).
Looking for a solution to this Alan! D'Oh!

Aspiring Techie,
Vishnu Nath


GeneralRe: How to close specific windows application when Computer is turned off or is restarted .memberEddy Vluggen0:56 14 Feb '09  
Vishnu Nath wrote:
I have seen that you can cannot kill anti-virus processes from windows task manager.

You mean that you don't know how to kill that antivirus proces - that doesn't mean that it's not possible. I'm killing the Norton-scanner prior to each build, since Visual Studio requires the resources.

Vishnu Nath wrote:
could not be killed by administrator of computer

I'd consider that a ransom-situation. The administrator owns the damn machine, and should have some control over what it does. Such programs are "malware" and Norton (or Avast, or MacAfee if they still exist) will try to remove it.

There's a huge difference in limiting the enduser and in limiting the administrator. Be carefull not to mix up both user-types Shucks

I are troll Smile

GeneralRe: How to close specific windows application when Computer is turned off or is restarted .memberVishnu Nath19:45 15 Feb '09  
You are right.
Thanks for your valuable advice and an important guidance to my project.
Thanks a Lot!! Big Grin

Aspiring Techie,
Vishnu Nath


Questionhow do i add values to listbox programmically? [modified]memberneodeaths23:59 11 Feb '09  
hi i am using a window form on vs 2005 with c#

i programically add in the items thru listbox.items.add()

however i am trying to add a values(which is hidden from the user)

as listbox.items.add("text") only add the text in but i cant seem to add a value in

anyone know how?

modified on Thursday, February 12, 2009 7:37 AM

AnswerRe: how do i add values to listbox programmically?memberAlan N2:20 12 Feb '09  
neodeaths wrote:
however i am trying to add values to it as well *e.g hidden values)


Can you edit this sentence to explain your requirement a little better. It's the "as well *e.g hidden values)" that has me baffled.

Alan
QuestionRe: how do i add values to listbox programmically?memberneodeaths2:51 12 Feb '09  
this better?
AnswerRe: how do i add values to listbox programmically?memberAlan N4:35 12 Feb '09  
A bit but I'm still not sure I'm there completely. Do you want to add an item to the list box but not have it displayed, i.e. have an invisible item.

I must have misunderstood as that doesn't make a lot of sense to me.

Perhaps you mean that you have added some items to the list box but they are not being displayed. Is that it?

Alan.
GeneralRe: how do i add values to listbox programmically?memberneodeaths4:42 12 Feb '09  
iam trying to hide a value from the user but still show certain infomation thats y iam doing the items adding programmically
GeneralRe: how do i add values to listbox programmically?memberAlan N4:58 12 Feb '09  
The ListBox is an user interface element and it's function is to display items. You can't selectively hide certain items.

What you can do is store all your items in a list and then only add the items that you want the user to see to the ListBox.

Alan.
GeneralRe: how do i add values to listbox programmically?memberAlan N5:02 12 Feb '09  
I'm quite happy to assist you with programming but I don't want to have spend time interpreting your text speak such as "y iam".

So please make it easy for people to help you!

Alan.

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   


Last Updated 9 Aug 2007
Web11 | Advertise | Privacy
Copyright © CodeProject, 1999-2009
All Rights Reserved. Terms of Use