ChrisHunter 152 Posting Whiz in Training Featured Poster

FPS all the way, can't wait for Battle Field 3 but Gears of War 3 is pritty good !

ChrisHunter 152 Posting Whiz in Training Featured Poster

adf

ChrisHunter 152 Posting Whiz in Training Featured Poster

Ben Howard - Keep your head up

ChrisHunter 152 Posting Whiz in Training Featured Poster

you dont make much sence but from what i can gather you want to get the results of a student by entering the student's enrolement number ? i thats the case are you using a connected database or arrays ?

ChrisHunter 152 Posting Whiz in Training Featured Poster

you'll need to know the structure of the Xml tree. so what are the parent nodes of the Amount and the ItemID. can out do a print screen of the xml document in you browser and attach it or see if you can put it in code brackets.

Have a look at these too and do a bit more research.

this
or
this

ChrisHunter 152 Posting Whiz in Training Featured Poster

The code below should load the xml file from the file path that is given, converts all child nodes of the outer most parent mode and stores it in an object's properties.

XmlDocument config = new XmlDocument();
                //Loads existing Xml document, located at directory passed to parameter
                config.Load(your_file_path);

                //Creates instance of all node within loaded Xml docuemnt and retrieves element by tag name
                XmlNodeList ObjectTypeID = config.GetElementsByTagName("ObjectTypeID");
                
		//Loops through foreach for each element specified by GetElementByTagName("")
                foreach (XmlNode n in ObjectTypeID)
                {
                    //Converts XmlNode to XmlElement
                    XmlElement _ObjectTypeID = (XmlElement)n;
                    //Converts and stroes value of specified attribute in property of ObjectTypeState class
                    objtyp.ObjectTypeID = Convert.ToInt32(_ObjectTypeID.GetAttribute("ID"));
                }

                XmlNodeList StateType = config.GetElementsByTagName("StateType");
                foreach (XmlNode n in StateType)
                {
                    XmlElement _statetype = (XmlElement)n;
                    objtyp.StateType = Convert.ToInt32(_statetype.GetAttribute("ID"));
                }

                XmlNodeList State = config.GetElementsByTagName("State");
                foreach (XmlNode n in State)
                {
                    XmlElement _State = (XmlElement)n;
                    objtyp.State = Convert.ToInt32(_State.GetAttribute("ID"));
                }
[DefaultPropertyAttribute("ObjectTypeID")]
    public class ObjectTypeState
    {

        #region Get/ Set properties
        //This region contains the Get and Set properties for each pricariable

        //Defines the catagory of which the property will be an attribute of, also sets the description of the attribute
        [CategoryAttribute("Main Object Type State Identifiers"), DescriptionAttribute("Object type ID"), ReadOnlyAttribute(true)]
        public int ObjectTypeID 
        {
            get;
            set;            
        }

        [CategoryAttribute("Main Object Type State Identifiers"), DescriptionAttribute(" state type of Object type"), ReadOnlyAttribute(true)]
        public int StateType
        {
            get;
            set;
        }

        [CategoryAttribute("Main Object Type State Identifiers"), DescriptionAttribute("state of object type"), ReadOnlyAttribute(true)]
        public int State
        {
            get;
            set;
        }
}
ChrisHunter 152 Posting Whiz in Training Featured Poster

Do you want to using C# to take data from an Xml file and then insert it into a DB using C# or parse it to Xml and then store it in the DB using Xml ?

ChrisHunter 152 Posting Whiz in Training Featured Poster

Read the Amount node value to a double and then do the foreach IF Amount > 0.00

ChrisHunter 152 Posting Whiz in Training Featured Poster

True something as insensative as the parent being shot in front of their child is going a bit far but games such as that and even call of duty do come with age ratings (which might not be enforces by some shops) and the adults who say games might harm kis must know that the games are rated above the age of their child, unless a kid punches another while playing Wii tennis or pulls a hammy.

It's all a matter of choise and the gamers/ buyers discretion when it comes down to it.

ChrisHunter 152 Posting Whiz in Training Featured Poster

parents should be cautious when let children play some games
because some may really do harm to your kids

I've never been punched in the face by a video game in over 15 years i've been playing.

Games can help with geography, i went to Venice and knew my way around without a map thanks to asassins creed and the main aim of the game is to stab people without being seen.

Someone has done a study in the UK too that says people who play computer games a lot can't tell the difference between reality and the games they play and look for the melee buttons and think they are charactors from the game. i think this is rubbish myself as there must be preexisting mental issues that are the main cause.

imAGamer i agree i go climbing to get my anger out and calmed down alot since i started climbing.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Complain about it, drink coffee make a start and fall asleep . .

ChrisHunter 152 Posting Whiz in Training Featured Poster

I thought hackers were orignaly enthusiasts who found ways into peoples systems, didnt corrupt or missuse the systems and more often than not reported the security risks to the owners of the systems ?

That isnt the case now like but the name was given in gest and to attract attention to the thread . . .

ChrisHunter 152 Posting Whiz in Training Featured Poster

Are you asking if your best using if/ else statements or case statements or are you asking for code that fullfils the above requirement ?

i think if/ else would be best but i think that may just be my preference really

ChrisHunter 152 Posting Whiz in Training Featured Poster

My mum doesn't use computers but she can still spot a scam, mainly because the emails are often about a subject that she has no interest in what so ever.

People who fall for scams such as the one above and use the excuse "i'm new to computers" or "i like rugby" but have never signed up to any rugby competitions are daft as Ken (Ken can be anything you want him to be ;) ) but it's a mistake people make and will more than likely learn from . . . if not then your a complete tool

ChrisHunter 152 Posting Whiz in Training Featured Poster

Me! Man that game is beautiful, I bet BF3 will only be slightly prettier. Come to think of it I need some more RAM too.

Other than that I have a small selection of Steam games, and I mainly play Counter-Strike: Source Beta. I would play Americas Army 3 more often but the game is just so terrible it barely runs on my system.

Whats this like online in comparison to how BF looks ? is it fast paced, amount of people playing and what match making is like ?

I'm investing in Gears3 when it comes out and cant wait for BF3, thats me becoming a recluse for the winter, the better half will NOT be happy.

ChrisHunter 152 Posting Whiz in Training Featured Poster

I agree with riteshbest make sure you don't jump into it all head first so as not to confuse yourself early on.

although i said don't jump in head first a few books are:
Head first C#
Object orientated programming consepts and design (good idea to understand the consepts too)

ChrisHunter 152 Posting Whiz in Training Featured Poster

Death or Glory - The Clash (i have the album playing through

ChrisHunter 152 Posting Whiz in Training Featured Poster

could you poaaibly add all questions to an array and then randomly choosing them by setting the scope of random.Next(); and use the random number generated to access a question using its index within the array ?

ChrisHunter 152 Posting Whiz in Training Featured Poster

See if this works if not i'm stuck too sorry

DateTime globalDT = Convert.ToDateTim(GlobalClass.globalweekdt);

int DTCompare = DateTime.Compare(DateTime.Now, globalDT);

if (DTCompare >= 7)            
{                
   MessageBox.Show("please update");            
}
ChrisHunter 152 Posting Whiz in Training Featured Poster

So do you want to use a tool strip (which has a number of menus which contain a number of menu items like file and help in Windows) on a form to minimise the number of forms you will need to implement all the required functions ?

ChrisHunter 152 Posting Whiz in Training Featured Poster

This might be what your looking for rather than my other suggestion. The compare just tells you if one date is earlier, the same or before the other.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Could you use a DateTime compare and set the reminder if the result of the comparison is 7?

Will you use this in a way which will run this check every time a user logs in so that if it has been 7 days when the user logs in then the reminder is set ?

ChrisHunter 152 Posting Whiz in Training Featured Poster

Just gradguated and had no proplem thing of a project title, ask your tutor. things like Windows applications connected to a DB and allows data to be exported to XML or Excel or making your own compiler will get you good marks if you pay enough attention to the detail

ChrisHunter 152 Posting Whiz in Training Featured Poster

have a look at this

ChrisHunter 152 Posting Whiz in Training Featured Poster

im a computer science student and i need three topics for my final year project....can anyone help pls

I've just done mine but i did mine for the company im working for now and it was a C# winForm app that manipulates data in an SQL server DB, exports selected data to XML and makes use of controls such as property grid, colour and font pickers and save/ open file dialog boxes.

You can do your project on anything you want realy, library mamagment, assignment hand in or event the foundations for a new IDE to help students understand programming. My sister made a assignment hand in application with a bar code scanner for her project about 5 years ago and a friend made a compiler which checks syntax, keywords and so on.

ChrisHunter 152 Posting Whiz in Training Featured Poster
ChrisHunter 152 Posting Whiz in Training Featured Poster

Take a look as this and this they might be of some help

ChrisHunter 152 Posting Whiz in Training Featured Poster

If your using VS just bind your dataGrid to your database and any changes to you make to your dataGrid will update your database.

ChrisHunter 152 Posting Whiz in Training Featured Poster

The spiral modle allows you to return to previous stages in the SDLC when new requirements or changes to previous sections are realised but generaly only allows for one final release to be made.

It also doesnt involve the customer(or user) in its sections other than requirements gathering.

the prototype (or evolutionary model) allows for a number of prototypes to be released to be tested by the customer. It also allows previous sections to be revisited if new requirements or designs are realised. it can be more costly and the structure of the project can be compramised due to constant changes is managed poorly. However the finished product is often better suited to what the customer(or user) requires.

carry out some research on the two as i've not done any work on system development life cycle and the different methodologies in a while but i'm pritty sure the above is correct.

ChrisHunter 152 Posting Whiz in Training Featured Poster

have you tried my solution ? i might be a bit longer but will still do the job. However do this in the line that says label.TEXT = . . .

lable1.Text = lable1.Text + "ID = " + id "\r\n";
ChrisHunter 152 Posting Whiz in Training Featured Poster

sorry i forgot to put

string sql = "SELECT COUNT(Custoberid) FROM mydatabase.studentinfo";
ChrisHunter 152 Posting Whiz in Training Featured Poster

To get the login form to show first go to Program.cs in your solution and change the Application.Run(new youformname); to be Application.Run(new Loginfor);

to show the menu, in the method that checks the login details do

MainForm mainFrm = new MainFor(); 
this.Hide();
mainFrm.Show();
ChrisHunter 152 Posting Whiz in Training Featured Poster

you need something like this (i might have made a few mistakes as im still new ish to c#, i did something similar in my uni project)

public void setLable()
{
	List<string> customerids = new List<string>();

	customerids = getCustonerID();
	
	foreach (string id in customerids)
	{
	    Lable1.TEXT = "ID = " + id "\n";
	}
}


public List<string> getCustiomerID()

	    string sql = "SELECT Custoberid FROM mydatabase.studentinfo";


            SqlCommand cmd2 = new SqlCommand(sql, db.Connect());

            List<string> CustomeridList = new List<string>();

            try
            {
                // Creates SQLdatareader
                SqlDataReader reader2;

                // Reads the result of cmd command
                reader2 = cmd2.ExecuteReader();

                // Loops while there is data to available to read
                while (reader2.Read())
                {
                    // Adds each ID read to a list of strings
                    CustomeridList.Add(reader2["Customerid "].ToString());
                }
                //Closes reader
                reader2.Close();
            }
            //Executed if try cannot execute
            catch (Exception ex)
            {
		throw Exception("" + ex);
            }

            //Returns string list
            return objectIDlist;
ChrisHunter 152 Posting Whiz in Training Featured Poster

Evolutionary model you can go back an alter different stages of the development at any point which is good because requirements and interface designs will more than likely change. It lets you make something that is closer to what the user wants in the long run . . . usualy, but it might get confusing if too many changes are made to previous sections during the life cycle.

perfect for students, i used it in my 3rd year project for my degree because i missed loads of stuff out of the requirements and changed the interface completely after trying to implement the orignal one

ChrisHunter 152 Posting Whiz in Training Featured Poster

To insert into more than one table at once try doing something like:

INSERT INTO (table1.coloumn1, table.column2) VALUE (value1, value2);

might not be exactly what you want but you'll probably want something along those lines to insert into multiple tables in 1 statement.

ChrisHunter 152 Posting Whiz in Training Featured Poster

arr i can't help you with that one sorry i couldn't get the password part working when i did my program for university sorry.

ChrisHunter 152 Posting Whiz in Training Featured Poster

make sure you have using System.Security.Principal; too

ChrisHunter 152 Posting Whiz in Training Featured Poster

What errors do you get ?

If you just want to verify that the username entered is the same as the Windows authentication username do something like:

string win_Name = WindowsIdentity.GetCurrent().Name.ToString();

and then compare this with the username entered by the user has entered, or if you have a database witht he Windows usernames in you can use the line above and just compare it with the username in the database.

ChrisHunter 152 Posting Whiz in Training Featured Poster

I made desktop app in VS 2010 for my final project in Uni an i made an app.config file with my connection string in which was like this:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
    </configSections>
    <connectionStrings>
        <add name="ConnectionString"
            connectionString="Data Source=MyPC\MyDB;Initial Catalog=MyDB;Integrated Security=True"
            providerName="System.Data.SqlClient" />
    </connectionStrings>
</configuration>

Next i created a class called DBConnect with a method which when called, establishes connection to the DB:

class DBConnection
    {
        #region Database connection method
        public SqlConnection Connect()
        {
            SqlConnection conn = new SqlConnection();
            conn.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();
            
            try
            {
                conn.Open();
            }
            catch
            {
            }
            return conn;
        }
        #endregion
    }

and when i want to carry out an querry on the DB i created an instance of the DBConnection class and did something like this which counts the number of rows in tbl1 that mach the WEHRE clause:

public bool checkForUser(string name)
        {
            //booliean variable called noUsers set with a value of false
            bool Users = false;

            //SQL string to count the amount of rows within the OSDE_Users table
            string sql = "SELECT COUNT(LogonName) FROM MyDB.tbl1 WHERE LogonName = '" + name + "'";

            SqlCommand cmd = new SqlCommand(sql, db.Connect());

            try
            {
                //Sets the value of int variable called rowCount with the result of the executed Sql statement called sql
                int rowCount = Convert.ToInt32(cmd.ExecuteScalar());

                //Executed if value of rowCount is greater than or equal to 1
                if (rowCount >= 1)
                {
                    ////Sets the value of noUsers to false
                    Users = true;
                }
                //Executed if value of rowCount is less than or equal …
ChrisHunter 152 Posting Whiz in Training Featured Poster

I agree with skatamatic, regions are greate for when sharing works with co-workers, means that you can label a section of code collaps it, makes your code look cleaner and a little less over-whelming to others.

ChrisHunter 152 Posting Whiz in Training Featured Poster

This is what i used to get the Windows identity of the user currently logged in.

System.Security.Principal;

    public partial class CLogin : Form
    {
        public void getName()
        {
            string name = WindowsIdentity.GetCurrent().Name.ToString();
            textBox1.Text = name;
        }
}
ChrisHunter 152 Posting Whiz in Training Featured Poster

Try using a saveFileDialog control and return the selected path. if you use the saveFileDialog control you can create the folders before hand, navigate to the folder you want to save your text file to, enter the desired name for the file and then use the .FileName property of the saveFileDialog control to get the path. You can use an openFileDialog control to do the opposite and it allows you to select any type of file.

As for creating a text file i've no idea as i've only created Xml files sorry.

ChrisHunter 152 Posting Whiz in Training Featured Poster

What type of file do you want to create ?

ChrisHunter 152 Posting Whiz in Training Featured Poster

If the file you want to access is always going to be in the same directory locate the file, copy the complete directory and put the file name and extention on the end of the directory like:

@"C:\\temp\\XmlFiles\\MyFile.xml"

ChrisHunter 152 Posting Whiz in Training Featured Poster

I don't know if this helps but it closes the current form containing the button that you click and opens the report when the button is clicked.

// declare this after the class constructor
Report newMDIChild = new Report(); 
  
private void button1_Click(object sender, EventArgs e)
{         
// Hides the current form        
this.Hide();            
// Display the new form.            
newMDIChild.Show();
}
ChrisHunter 152 Posting Whiz in Training Featured Poster

Can you get the username as well as the password of the user currently logged in by using WMI or DirectorySetvices ?

My app is just a windows form app and not ASP or a web app is that would make any difference to you suggestion ?

ChrisHunter 152 Posting Whiz in Training Featured Poster

Hi, i'm tryin to use windows authentication to log into an application i have made. I have already worked out how to get the username but i can't figure out how to get the password too.

Is this possible ? if so can anyone suggest any ways to do this or any tutorials please ?

Any suggestions would be great.

Thanks

Chris

ChrisHunter 152 Posting Whiz in Training Featured Poster

Thank you this worked perfectly

ChrisHunter 152 Posting Whiz in Training Featured Poster

I had a similar problem with a databound combo box and didnt figure it out but try comboBox.SelectedItem or comboBox.Text thats how i get the currently selected item or the text of a combobox

ChrisHunter 152 Posting Whiz in Training Featured Poster

Hi, i'm having a problem trying to print out a list of strings. i can get them to print out using rectangles successfully but when the bottom of the page is reached it wont go onto the next page, instead it just stops printing.

I've done this so far which just repeats the first page over and over rather than just printing the rest of the text on a new page:

private void document_PrintPage(object sender, PrintPageEventArgs e)
        {
            List<string> propNames = new List<string>();
            List<string> propValue = new List<string>();

            Font titleFont = new Font("Arial", 22, System.Drawing.FontStyle.Regular);
            string title = "Object State Default";

            RectangleF rect = new RectangleF();
            rect.X = 50.0F;
            rect.Y = 30.0F;
            rect.Width = 300.0F;
            rect.Height = 50.0F;
            SolidBrush brush = new SolidBrush(Color.Black);
            Pen blackpen = new Pen(Color.Transparent);            
            Font printFont = new Font("Arial", 11, System.Drawing.FontStyle.Regular);
            //Gets names of all properties
            propNames = printObject(objtyp);
            //Gets values of all properties
            propValue = getPrintValues();
            //Draws title of the page
            e.Graphics.DrawString(title, titleFont, brush, rect);
            //Sets position for next rectangle
            rect.Y = rect.Y + 75;

            for (int i = 0; i < propNames.Count && i < propValue.Count; i++)
            {
                e.Graphics.DrawString(propNames.ElementAt(i), printFont, brush, rect);
                rect.X = rect.X + 300;
                e.Graphics.DrawString(propValue.ElementAt(i), printFont, brush, rect);
                rect.Y = rect.Y + 30;
                   
                if (rect.Y >= 1100)
                {
                    e.HasMorePages = true;
                }
                else
                {
                    e.HasMorePages = false;
                }
            }            
        }

Any help with this would be great !

Thanks

Chris