Help with creating a list, adding to it, calling it and putting it in a combobox with c#

I have been making a word RPG game with the windows form in c#, and I have encountered some problems along the way. Right now I have a character creation screen, and a screen that displays all of the stats, and gear equipment. I was thinking about adding
some basic/starting items and put the list into a combobox. I created a separate class and named it HeadItems.cs, and put all of the possible stats, as well as ID and string name. I set a constructor with many parameters, so I can simply input this code, and
have it generate a head item.
HeadItems.Add(new HeadItem("Test Head", 0,2,0,0,1));
Then I was trying to make the combobox, called cboHeadItems, and put its DataSource as HeadItems. Though I am not sure how to get it so it displays the first array, or the string name in the combobox. I am also not sure if I should create the list in the
player entity class or its own class. From there I am not sure how to call the list on other forms/classes or how to make the name appear in the combobox for people to select.

Hiya!
It isn't that simple I'm afraid! You cant make the datasource of a combobox a 'HeadItem' because it doesn't know what that is and it won't know how to handle it.
There are a few different ways to do it. You can pass it an array, a dataset, a datatable to mention just a few.
Probably the simplest way is this:
foreach(HeadItem hi in HeadItems){
comboBox1.Items.Add(hi[0]); //Depends on your setup
Antony
:D

Similar Messages

  • I recently forgot the password for my iTunes UK account with 100 pounds of credit. I called apple and said no one could help me if I did not know the security questions. Really?

    I recently forgot the password for my iTunes UK account with 100 pounds of credit. I called apple and said no one could help me if I did not know the security questions. Really? This company that pretty much can do anything is not able to tell me what the password is?
    Any help i appreciated!!!! what doe aApple do with all the unclaimed money from lost or forgotten accounts?
    Jeffrey

    For a forgotten password: go to http://iforgot.apple.com and sign in with your iCloud login. A new password will be sent to your associated email address. If this doesn't work you will have to contact Support. Go to https://getsupport.apple.com; click' See all products and services', then 'More Products and Services, then 'Apple ID', then 'Other Apple ID Topics' then 'Lost or forgotten Apple ID password'.
    For forgotten security questions log in at http://appleid.apple.com and click 'Password and Security' in the sidebar. There should be a link in the Security Questions section to send the answers to an email you have specified. Failing this, go to https://getsupport.apple.com click 'See all products and services', then 'More Products and Services, then 'Apple ID', then 'Other Apple ID Topics' then 'Forgotten Apple ID security questions'.

  • How to create bdc for fbs1 using both call transaction and session

    Hi Friends,
    i have one problem with tcode FBS1, i need to create a bdc program for both call transaction and session method using subroutine.
    first call transaction needs to execute if there is an error sesion has to execute. if u have code please forward.
    thanks in advance.
    chandramouli pothugunta

    where as in call transaction we can do error handling explictly.those errors  are stored in one file .this file will send to the error log(session method),i.e session log.
    in the above case we use both call transaction n session method at time in one program.sample code is below ,go through it .
    data : begin of itxk01 occurs 0,
    end of itxk01.
    data : bdcdata like itbdcdata occurs 0 with header line.
    data : itbdcmsgcoll like itbdcmsgcoll occurs 0 with header line,
             itxk01 like itxk01-dup occurs 0 with header line.
    call gui-upload.
    loop at itxk01.
    refresh itxk01.
    perform bdc-dynpr0 using 'prg' 'scr'
    perform bdc-dynfld using fnam fval
    call transaction 'xk01' using bdcdata mode 'a' update 's' messages into itbdcmsgcoll.
    if sy-subrc ne 0.
    append itxk01 into  itxk01-dup.
    endif.
    endloop.
    if not itxk01-dup[] is initial.
    refresh itck01.
    call bdc_open_group
    itxk01 = itxk01-dup.
    loop at itxk01.
    refresh itxk01.
    perform bdc-dynpr0 using 'prg' 'scr'
    perform bdc-dynfld using fnam fval
    call bdc-insert.
    endloop.
    call bdc-close-group.
    form bdc-dynpr0 using pr sc
    endform .
    form bdc-field  using fnam faval
    endform.
    this will help u.
    reward points for me
    kiran

  • How do i take a playlist from my itunes, and put it onto my ipod with the newest itunes?

    How do i take a playlist from my itunes, and put it onto my ipod with the new itunes?

    For music that you've purchased from Apple that are on your iPhone you should be able to copy to your computer's iTunes via File > Transfer Purchases. Also if you are in the US then you should be able to re-download past music purchases for free : http://support.apple.com/kb/HT2519
    For your own music that you've copied, then if you haven't got a backup on, for example, external drives or CDs/DVDs then you could see if any of the utilities mentioned in this old post still exist and work

  • How can i do with labview program,when i have 20 different values,and 1 want to add it with constant value.and how to get the results?

    how can i do with labview program,when i have   20 different values,and 1 want to add it with constant value.and how to get the results?

    Why do the 20 values have to be different? The same code should work even if some are equal.
    What do you mean by "get the result"? The result is available at the output terminal and all you need is a wire to get it where you need it. That could be an indicator, another operation, or even a hardware device.
    What is the data type of the 20 values? An array? A cluster? A bunch of scalars? A waveform? Dynamic data?
    LabVIEW Champion . Do more with less code and in less time .

  • My ipod has a black screen.  I have tried to hold the sleep/off button and menu button at the same time with no luck.   I connected to my computer and tried restore on itunes -  still with a black screen a voice said "screen locked'  code 542

    My ipod has a black screen.  I have tried to hold the sleep/off button and menu button at the same time with no luck.   I connected to my computer and tried restore on itunes -  still with a black screen a voice said "screen locked'  code 542

    Is the iPad charged?  Plug it in with the charger/wall outlet for half an hour and try again to reboot by holding both the power and home buttons until the apple logo appears.

  • I frequently get the messages "windows couldn't sign you out" (I am signed out) ,"not connected to in the internet" with prompts to sign in again (I don't) and "you're currently working offline", with a prompt to connect to my own locked wireless. None of

    I frequently get the messages "windows couldn't sign you out" (I am signed out) ,"not connected to in the internet" with prompts to sign in again (I don't) and "you're currently working offline", with a prompt to connect to my own locked wireless. None of these statements are true and I ignore the prompts (although my husband did re-sign on to our router once). I find that if I unplug the phone line and then plug it in again, it works. Strange. Is someone trying to get my password?
    == This happened ==
    A few times a week
    == when we had internet installed by comcast

    Try Settings > General > Reset > Reset Network Settings.
    Read this:
    http://support.apple.com/kb/TS4008

  • Event Receiver to create a List based on a custom template and on lookup field

    Hi
    I would like to have an Event Receiver who is firing by addItem in a list calls Seminarliste and is creating each time a new list based on three columns for add.Lists("Title of the list", "Description of the list", "Custom List
    Template")
    I have a Problem to get the LookupField Title and I am getting a Problem to create a list.
    If I debug the code the bold line creates an exception ;(
    The following code I have produced:
            public override void ItemAdding(SPItemEventProperties properties)
                base.ItemAdding(properties);
                SPWeb spCurrentSite = properties.OpenWeb();
                SPSite siteCollection = new SPSite("http://win-ue32d37ap2n");
                SPWeb web = siteCollection.OpenWeb();
                SPListCollection lists = web.Lists;
                String curListName = properties.ListTitle;
                if(curListName == "Seminarliste")
                    SPListItem curItem = properties.ListItem;
                    String curItemListName = properties.AfterProperties["Title"].ToString();
                    String curItemDescription = properties.AfterProperties["Beschreibung"].ToString();
                    // Lookup field with Option to Chose a template name
                    String curItemTemplate = properties.AfterProperties["Template"].ToString();
                    SPListTemplateCollection listTemplates = siteCollection.GetCustomListTemplates(web);
                    //Error by following line ...
    SPListTemplate myTemplate = listTemplates[curItemTemplate];
                    web.Lists.Add(curItemListName, curItemDescription, myTemplate);
    If somebody had a similar problem in the past and could advice it would be most appreciated ;-)
    Thanks in advance ;-)
    Kind regards Michael Damaschke

    If I understand correctly, the field you use to select the template name is a lookup field? If so, then the problem is the lookup field value is not the name of the template. It is an SPFieldLookupValue, which contains the ID and the string of the lookup.
    So you want to separate the template name, like this:
    if (item["LookupField"] !=
    null)
         string fieldValue = item["LookupField"].ToString();
         SPFieldLookupValue value =
    new SPFieldLookupValue(fieldValue);
         int lookupListItemID = value.LookupId;
         string lookupListValue = value.LookupValue;
    IF you look at the fieldValue above, you will see it is something like an integer, followed by delimiter ;# and then your template name. you can always just parse the string at the ;# as well if you were so inclined.

  • I am creating a list.  Page 1 is full and I can't figure out how to get to page 2.

    I am creating a list.  Page 1 is full but I can't figure out how to get to page 2.

    It would help if you told us which ages version you use? Are you still on MacOs 10.6.8?
    Did you use text boxes?

  • Finesse -( UCCX 10) - Create a list of actions for Call ends

    Hi,
    I want to create a list of actions in Finesse, when the call ends for Agent, it dials another Trigger.  How can I do that?
    There are two options, Browser pop-up or HTTP Request. Unfortunately there is not enough document about this on the net.
    Thanks,
    HM

    Hi,
    Actually my requirement is to allow users to select multiple values from an LOV i.e. 7,8,11 (comma seperated). As it is not possible with the standard list of values to select multiple values so I'm using the above document from the Metalink to create an LOV with the same look and feel as the standard LOV of forms. I've tried all the steps but unfortunately no luck.
    Elements in List => put one item with space <--- i'm confused on this one, may be i'm not setting this properly.
    Thanks
    regards
    RM

  • I have a problem with the connection i always have a call drop and there is a sound seems like something loose inside when tapping on the back of the iphone 4s

    does any one have this problem and what is the fix for this issue ... and why all of these issues with iphone 4s??!!!!!

    If you have your iPod set to transfer your music manually, then that “do not disconnect” message will continue to be displayed on your iPod until you manually eject it.
    You can do this by clicking on the little eject icon next to the iPod listing in the source window of iTunes, or right click on it and select “eject”. There is also an iPod 'eject' icon in the lower right hand corner of iTunes. Another way would be to use the “safely remove hardware” icon in the system tray next to the clock (looks like a grey rectangle with a green arrow above it). Click on this then select your iPod. Or through Windows, select start/my computer, right click on the iPod, select eject. With a Mac, drag the iPod into the trash.
    If you have your iPod set to automatically sync with iTunes, right click on the iPod in iTunes, select options and if you have a check mark in the box marked “enable disk use”, remove it and your iPod should automatically disconnect after it’s finished transferring music.

  • How to have a picture with 3 people and put them in a picture with one person

    I don't know if this would come under photomerge or not but I want to take this picture with 3 people in it and add them to a picture with just 1 person.

    Use on of the selection tools, e.g. selection brush, lasso tool, to make a selection of the 3 people. Once you have a complete selection, you will see "marching ants" surrounding it
    Go to Edit>copy to put the selection on the clipboard
    Open the 2nd picture
    Go to Edit>paste. The selection will be on its own layer
    Get the move tool in toolbox, position the selection, and resize it, if necessary, with the corner handles of the bounding box.

  • When i open safari an apple alert comes up with a phone number.  when i call i get put on hold forever.  how do i get this off there?

    when i open safari an apple alert comes up with a phone number to call.  when i call i get put on hold forever or no one calls me back.  how do i get this off there and what is it?

    It's a scam. Do not call the number. There are several ways to recover.
    1. Some of those scam pages can be dismissed very easily. Press the key combination command-W to close the tab or window. A huge box will pop up. Press the return key and both the box and the page will close. If that doesn't happen, continue.
    2. Press and hold command-W. You may hear repeating alert sounds. While holding the keys, click the OK button in the popup. A different popup may appear, which you can cancel out of as usual.
    3. From the Safari menu bar, select
              Safari ▹ Preferences... ▹ Security
    and uncheck the box marked Enable JavaScript. Leave the preferences dialog open.
    Close the malicious window or tab.
    Re-enable JavaScript and close the preferences dialog.
    4. If the Preferences menu item is grayed out, quit Safari. Force quit if necessary. Relaunch it by holding down the shift key and clicking its icon in the Dock. None of the windows and tabs will reopen.
    After closing the malicious page, from the menu bar, select
              Safari ▹ Preferences... ▹ Privacy ▹ Remove All Website Data
    to get rid of any cookies or other data left by the server. Open your Downloads folder and delete anything you don't recognize.

  • Help with Creating a list based on conditions

    Hi, im doing a project in java at college, and this is what the project says;
    Every November, on the last Wednesday of the month, Salchester Primary School holds its annual school games competition. The school is very small and pupils from all classes belong to Houses which compete for the House Cup. Each pupil belongs to either the Green or Yellow House. The names of pupils and numbers in each class are provided for you, together with their House.
    The games that are played during the day are:
    " Snap
    " Cribbage
    " Spillikins
    " Junior Scrabble.
    The structure of the competition is as follows:
    " the Yellow and Green Houses compete against each other in a series of
    matches
    " each match is best of three single games of one type of game
    " pupils cannot play other pupils from the same class
    " pupils can only play another pupil once
    " each pupil will take part in one match for each type of game.
    To allow results to be entered, the aim of the program is to
    " prepare a list of matches for the games competition
    " identify the winners of each match on the schedule
    " calculate the points awarded to each House.so far i have created the following classes;
    the student class which outlines all of the methods that i think are needed in the programme
    public class student
        private String name;
        private int c_lass;
        private int []game;
        private int [] oponent;
    public student(String n, int c)
            oponent=new int [18];
            game = new int [4];
            game[0] = -1;
            game[1] = -1;
            game [2] = -1;
            game[3] = -1;
            c_lass = c;
            name = n;
    public String getName()
          return name;     
    public int getC_lass()
          return c_lass;   
    public int getGame(int y)
          return game [y];     
    public int getOponent(int y)
          return oponent [y];     
    public void changeName (String y)
          name = y;     
    public void changeC_lass (int y)
          c_lass = y;     
    public void changeGame (int gindex, int oponent)
         game [gindex] = oponent;      
    public void eraseGame (int y)
         game [y] = -1;      
    public void eraseOponent (int y)
         oponent [y] = 0;      
    public void changeOponent (int y)
         oponent [y] = 1;      
      }and the student details, this class holds all of the ifnormation about the students, for example their name what colour their house is and the class number
    public class studentdetails
        private student [] gh = new student [18];
        private student [] yh = new student [18];
        public studentdetails()
    public void createstudentdetails ()
            //Class 1 Green house
        gh[0]=new student("Arnold",1);
        gh[1]=new student("Bertha",1);
        gh[2]=new student("Bella",1);
            //Class 2 Green house
        gh[3]=new student("Charles",2);
        gh[4]=new student("Denise",2);
            //Class 3 Green house
        gh[5]=new student("Edward",3);
        gh[6]=new student("Earl",3);
        gh[7]=new student("Freeda",3);
            //Class 4 Green house   
        gh[8]=new student("Genorge",4);
        gh[9]=new student("Gerry",4);
        gh[10]=new student("Hrriet",4);
        gh[11]=new student("Helen",4);
             //Class 5 Green house
        gh[12]=new student("Ian",5);
        gh[13]=new student("Issac",5);
        gh[14]=new student("Gerry",5);
            //Class 6 Green house
        gh[15]=new student("Keith",6); 
        gh[16]=new student("Kevin",6);
        gh[17]=new student("Leila",6);
            //Class 1 Yellow house
        yh[0]=new student("Albert",1);
        yh[1]=new student("Aswan",1);
        yh[2]=new student("Betty",1);
            //Class 2 Yellow house
        yh[3]=new student("Colin",2);
        yh[4]=new student("Debra",2);
            //Class 3 Yellow house
        yh[5]=new student("Elias",3);
        yh[6]=new student("Felicity",3);
        yh[7]=new student("Fiona",3);
            //Class 4 Yellow house
        yh[8]=new student("Gilbert",4);
        yh[9]=new student("Gwyn",4);
        yh[10]=new student("Hebe",4);
        yh[11]=new student("Hillary",4);
            //Class 5 Yellow house
        yh[12]=new student("Idris",5);
        yh[13]=new student("Jane",5);
        yh[14]=new student("Jasmine",5);
            //Class 6 Yellow house
        yh[15]=new student("Kenny",1);
        yh[16]=new student("Laura",2);
        yh[17]=new student("Linda",3);
    public void printstudentdetails()
    for(int i=0;i<18;i++)
            System.out.println (gh .getName () + " Class " + gh [i].getC_lass() + " Green House" );
    System.out.println (yh [i].getName () + " Class " + yh [i].getC_lass() + " Yellow House" );
    the problem is now in creating the match list. The match list is really hard and so far ive done the following but i cant get it to work, could anyone point me in the right direction.public class ListOfMatch
    private studentdetails SB=new studentdetails();
    public ListOfMatch()
    public void CreateMatch()
    SB.createstudentdetails();
    for (int g=0;g<1;g++){
    for (int i=0;i<18;i++){
    if (SB.getsy (i).getGame(g)==-1){
    for(int j=0;j<18;j++){
    if (SB.getsy(i).getC_lass()!=SB.getsg(j).getC_lass()){
    SB.getsy(i).changeGame(g,j);
    SB.getsg(j).changeGame(g,i);
    SB.getsy(i).changeOponent(j);
    SB.getsg(j).changeOponent(i);
    System.out.println(SB.getyh(i).getName()+SB.getgh(j).getName());

    IMO you are doing it wrong and not really OO
    Also please use Standard Java Coding Conventions ( and try use correct spelling)
    You should declare a Game class, a House class a classGroup class and a Student class
    To create the matchups you then can pick student from each classGroup.

  • Help with creating a list

    I query id values from one of my table.
    I need to come up with a list that looks like:
    id='123' OR id='234' OR id='002' OR id='345' OR id='435'
    I came up with 123,234,002,345,435 and '123' , '234' , '002' , '435' and also '123' OR '234' OR '002' OR '435'
    but very frustrated with putting id= on each list element to come up with id='123' OR id='234' OR id='002' OR id='345' OR id='435'
    Can anyone think of a technique to create such a list dynamically from a query result?
    Thanks!

    You could create a user defined function that converts a comma delimited list of values into one formatted with id's and OR's.
    Here is a quick sample which has NOT been tested.
    <cffunction name="customFormatOrList" returntype="string" output="no" hint="Converts comma delimited list to OR query string">
        <cfargument name="inputList" type="string" required="yes" hint="Comma delimited list" />
        <cfset var local=StructNew() />
        <cfset local.resultString="" />
        <cfloop list="#arguments.inputList#" index="local.idx">
            <!--- add 'OR' if this is not the first item --->
            <cfif Len(local.resultString) gt 0>
                <cfset local.resultString="#local.resultString# OR " />
            </cfif>
            <cfset local.resultString="#local.resultString#id='#local.idx#'" />
        </cfloop>
        <cfreturn local.resultString />
    </cffunction>

Maybe you are looking for