Showing posts with label windows application. Show all posts
Showing posts with label windows application. Show all posts

Sunday, August 21, 2011

.Net Interview Question:- How to add your window application icon to the task bar?

This is not one of the .NET typical interview question but as a developer you would be interested in knowing that how to add your windows application icon in to the task bar.
Let’s demonstrate a simple example to see how exactly you can add your windows
application icon in the task bar.

In order to achieve the above subject just follow the following steps.

Step1: - create a windows application for that Go To > File >
New
> Project > Windows > Select Windows Forms Application.





Step2: - Now from the toolbox just add the “NotifyIcon” control to the main
form.


Step3: - Go to the properties of the NotifyIcon control and set the properties
like below diagram.



In the above diagram you can see that I have set the following properties.

BalloonTipIcon = Warning.

BalloonTipText = Click to enlarge.

BalloonTipTitle = Message.


Note
: - please select an icon with .ico extension with maximum size of48 * 48.
Step4: - Add a Button on the form and add the below code snippet in to
Form1.cs.

private void button1_Click(object sender, EventArgs e)

{

notifyIcon1.ShowBalloonTip(1);

this.Visible = false;

}

Once you have completed with all the above steps now just run your
application and will see that the selected application icon is now being added
to the task bar to the right bottom of your screen like below diagram.




In above diagram you can clearly see that now the application icon is being
added to the task bar.
Now, when you click on the Button1 you will see a message pops up like below diagram as we have declared to the properties of the NotifyIcon control.



Also view our video of C# interview questions on Garbage Collector as follows: -


Visit us for more tutorials on Most asked Dotnet interview questions

Regards,
Get more .Net / C# interview questions from author’s blog









Tuesday, August 2, 2011

C# and .NET interview questions: - How do we create a Windows Process in .NET?

Process: - Process is a Component that provides access to the processes that are
running on a computer.

The Process component is a useful tool for starting, stopping, controlling, and
monitoring applications. Using the Process component, you can obtain a list of
the processes that are running, or you can start a new process.

Let’s demonstrate a simple example on Process to get a better idea.

Create a new project > Go to File > New > Project > and Select Console
Application.






Now, let’s demonstrate how exactly we can start new processes of the windows
using Process Component.

Go to “Program.cs” and import the following two namespace into it.


using System.Diagnostics;

using System.ComponentModel;

Below is the full code snippet for the same.

namespace MyProcessSample
{
class MyProcess
{
void OpenApplication(string myFavoritesPath)
{
// Display the contents of the favorites folder in the browser.
Process.Start(myFavoritesPath);
}

// Opens urls using Internet Explorer.
void OpenWithArguments()
{
Process.Start("IExplore.exe", "www.indonepal.com");
}

// Uses the ProcessStartInfo class to start new processes,
void OpenWithStartInfo()
{
ProcessStartInfo startInfo = new ProcessStartInfo("firefox.exe");
startInfo.Arguments = "www.questpond.com/demo.html";
Process.Start(startInfo);
}

static void Main()
{
// Get the path that stores favorite links.
string myFavoritesPath = Environment.GetFolderPath(Environment.SpecialFolder.Favorites);
MyProcess myProcess = new MyProcess();
myProcess.OpenApplication(myFavoritesPath);
myProcess.OpenWithArguments();
myProcess.OpenWithStartInfo();
}
}
}

Once you have done with above step just run your application and view the
result.

Following you can view video on CAS, evidence, permission set & code groups: -





Get our more C# and Dotnet interview questions for preparation.

Regards,

Also Visit for more author’s blog on Most asked c# interview questions

Monday, May 16, 2011

C# and .NET interview questions - Show us the steps to create setup & deployment project for windows application?

Answer:
This is a typical .Net interview question which is asked to understand if you know how to create deployment packages. When you are done with your application you would like to give your end user a setup package rather than the source code.
The short answer which the interviewer is expecting is that we can use the Visual studio deployment package project. Now the long answer just in case the interviewer gets in to details. So lets understand step by step of how to create a deployment package.
Following are the simple steps for creating setup and deployment for window application:
Step 1: Go to file and click add new project > select other project type >
setup and deployment >visual studio installer then select the setup project,
below are the sample diagrams which you need to follow.






The default File System editor will appear in the window as shown in the
below diagram.



Step 2:Select Application Folder and right click Add>Project Output>select Primary output.






Step 3: If you want to shortcut on desktop then Select User’s Desktop right
click on the second window>click create new shortcut>select output file from
Application folder>change the file name from primary output which you want.




If you want to shortcut on program menu then Select User’s Programs Menu right click on the second window>click create new shortcut>select output file from Application folder>change the file name from primary output which you want.
If you want to change the Manufactures name and other properties just right
click the project goes to properties.




Step 4: Finally Build the Setup1 project.



Exe or installer will be available on the physical path of the project.






Please click here to see more c# and Dotnet interview questions

Regards,

Visit Authors blog for more Most asked c# interview questions