A few C questions

Thread Tools Search this Thread
Top Forums Programming A few C questions
# 1  
Old 10-07-2007
A few C questions

Hi guys. I'm writing a basic script in C# and there's a few areas where I am stuck, and I was wondering if you may be able to help me?

1) Can you embed an image into the source code so it will show in the windows GUI?
2) Can you change the background of the GUI?
3) How do you add an .ico to the source code so the icon looks better then the boring standard box and the top left image changes in the GUI?

If it helps here is my source code so far;

using System ;
using System.Windows.Forms ;

public class login
	static TextBox txt1 = new TextBox() ;
	static TextBox txt2 = new TextBox() ;
	static Button btn1 = new Button() ;
	static Label sysMsg = new Label() ;
	static Label usrMsg = new Label() ;
	static Label pwdMsg = new Label() ;
	public static void Main()
		Form frmMain = new Form() ;
		frmMain.Text = "Login Client" ;
		frmMain.StartPosition = FormStartPosition.CenterScreen ;
		frmMain.Closed += new EventHandler(frmMain_Closed) ;
		txt1.Location = new System.Drawing.Point(100,10) ;
		txt2.Location = new System.Drawing.Point(100,50) ;
		btn1.Text = "Login" ;
		btn1.Location = new System.Drawing.Point(10,100) ;
		btn1.Click += new EventHandler(btn1_Click) ;
		usrMsg.Text = "Username" ;
		usrMsg.AutoSize = true ;
		usrMsg.Location = new System.Drawing.Point(10,15) ;
		pwdMsg.Text = "Password" ;
		pwdMsg.AutoSize = true ;
		pwdMsg.Location = new System.Drawing.Point(10,55) ;
		sysMsg.Text = " " ;
		sysMsg.AutoSize = true ;
		sysMsg.Location = new System.Drawing.Point(10,130) ;
		frmMain.Controls.Add( txt1 ) ;
		frmMain.Controls.Add( txt2 ) ;
		frmMain.Controls.Add( btn1 ) ;
		frmMain.Controls.Add( sysMsg ) ;
		frmMain.Controls.Add( usrMsg ) ;
		frmMain.Controls.Add( pwdMsg ) ;
		frmMain.Show() ;
		Application.Run() ;
	private static void frmMain_Closed( object sender, System.EventArgs e)
		Application.Exit() ;
	private static void btn1_Click( object s, System.EventArgs e)
		sysMsg.Text = ( txt1.Text.Equals( String.Empty ) ) ? "Incorrect Username or Password" : "Logging in..." ;

# 2  
Old 10-07-2007
C# is a compiled language so it's normally not called a script, instead it is referred to as source code.

Also, it's a Microsoft invention, so you might want to check the URL of the forum you are posting on.

That said, there may well be people here who can help.
# 3  
Old 10-08-2007
Originally Posted by porter
Also, it's a Microsoft invention, so you might want to check the URL of the forum you are posting on.

That said, there may well be people here who can help.

According to several (old) posts by Neo, the UNIX in URL stands for "Universal Internet eXchange" of information so you can ask C# questions here. It is true, however, that you may not get too many people with C# knowledge on this site.
# 4  
Old 10-09-2007

After approximately 30 seconds of searching on google I found the answer to all 3 of your questions.

1 & 2) Add image to Button : Button : GUI Windows Form : C# / C Sharp examples (example source code) Organized by topic

3) Adding tray icons and context menus - The Code Project - C# Programming

the link for 1 & 2 will point you in the right direction. To be honest I do more middle-tier work in C# and test builds with NUnit so I don't know too much about these nice pretty picture thingys that Front End developers deal with Smilie I've done more GUI related work in Java with Swing/AWT and looking over C# there are quite a number of similarities. With C# it looks a whole lot easier to develop GUIs but then again, try deploying your C# app to a Unix box of some description Smilie well without Wine anyway.
# 5  
Old 10-09-2007
Originally Posted by blowtorch
According to several (old) posts by Neo, the UNIX in URL stands for "Universal Internet eXchange" of information
Sounds like a fudge to me. Smilie

However I don't think SCO will bother to sue.
# 6  
Old 10-09-2007
The legal right to this domain has already been established, so there is no scope for SCO or anyone else to sue.

This discussion is not relevent to the original question asked, this topic and since the original question also answered, this thread, are closed.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Vi questions

Hello, I would like to know how we can highlight/select a section of a file in vi and delete that section if we don't want to use the dd command to delete one line at at time. There is one where we don't want to delete the whole line , but up to a certain word. (2 Replies)
Discussion started by: Pouchie1
2 Replies

2. UNIX for Dummies Questions & Answers

Just had a few questions

1) The lpr and sort utilities accept input either from a file named on the command line or from standard input. a)Name two other utilities that function in a similar manner. b)Name a utility that accepts its input only from standard input. 2) Explain the following error message. What... (10 Replies)
Discussion started by: youngyou
10 Replies

3. Homework & Coursework Questions

Print questions from a questions folder in a sequential order

1.) I am to write scripts that will be phasetest folder in the home directory. 2.) The folder should have a set-up,phase and display files I have written a small script which i used to check for the existing users and their password. What I need help with: I have a set of questions in a... (19 Replies)
Discussion started by: moraks007
19 Replies

4. Programming

two questions

hey all, I have question when am writing simple shell... in the child am calling execvp, i want the parent to know when execvp returns - 1. how can i let the parent know the result of execvp thanks in advance (9 Replies)
Discussion started by: joey
9 Replies

5. UNIX for Dummies Questions & Answers

Just a few questions.

Hi everyone im new to this forums, i just wanted to get started by asking a few question(Im a Unix newbie) 1. How do i sort a file called "dirr" in a ascending order on the 3rd column 2. what does alias on=who do Thanks in advance!!! (1 Reply)
Discussion started by: Da Paper
1 Replies

6. Solaris

2 Questions

Hello Everbody I hope you can give me a hand, I have some questions The first one itīs about some message that I donīt know what means, I was looking about it. but nothing. This is the message rsh: connection from bad port bsd-gw: Error reading from connection: Bad file number And my... (4 Replies)
Discussion started by: lo-lp-kl
4 Replies

7. Programming

C questions

What does "extern" do? ex. extern int x; and another question, what about using static in functions? like: static void foo(), why? (2 Replies)
Discussion started by: Esaia
2 Replies

8. UNIX for Dummies Questions & Answers

i got some questions :)

Hi! Im new to all this but the computer club im in has unix i think. now my questions. 1.is it NTFS i need to partion the harddrive with to be able to use unix? 2.Unix and Linux whats the diffrense?yes im a noob got no idea been using crap windows for ages and hate it. 3.I got a win98... (2 Replies)
Discussion started by: Pierre
2 Replies
Login or Register to Ask a Question