Question

In: Computer Science

I'm trying to space out my 3 inputs when they are displayed in the list box....

I'm trying to space out my 3 inputs when they are displayed in the list box. I've tried putting "\t" and "" in between inputs and it makes the 3rd input not visible, I've tried expanding my listbox and it still wasn't visible either.

private void button2_Click(object sender, EventArgs e)

{

//clear any previous values

listBox3.Items.Clear();

for (int index = 0; index < currentCapacity; index++)

{ listBox3.Items.Add(string.Format("{0, -10}{1, 10}{2, 10}", name[index],numTickets[index],costs[index].ToString("C"))); }

}

Solutions

Expert Solution

Below is the solution:

private void button2_Click(object sender, EventArgs e)
        {
            for (int index = 0; index < 5; index++)
            {
                listBox3.Items.Add("Ticket Name\t" + 123456 + "\t" + 23.67.ToString("C")); //try it that way
                //listBox3.Items.Add(string.Format("{0, 10}{1, 10}{2, 10}", "Ticket Name", 123456, 23.67.ToString("C"))); //this is also working fine
            }    
        }


Related Solutions

I'm having trouble with my do while loop. I'm trying to get it where if the...
I'm having trouble with my do while loop. I'm trying to get it where if the user enter's 3 after whatever amount of caffeinated beverages they've entered before then the loop will close and the rest of my code would proceed to execute and calculate the average price of all the caffeinated beverages entered. Can someone please help me with this? Here's my Code: import java.util.Scanner; public class Main { public static void main(String[] args) { CaffeinatedBeverage[] inventory = new...
I'm working on a to-do list program in Python 2. I'm trying to delete an item...
I'm working on a to-do list program in Python 2. I'm trying to delete an item from the list and I'm not sure what I'm missing to do that. I haven't been able to get it to delete by string or by index number. Also, I'm trying to get the menu to run again after the user completes the add/delete/etc options. Do I need to put menu() menu_option = int(input("Welcome to your To-Do List. Please choose and option to continue:...
I'm using my TI-84 plus calculator trying to figure out the critical value(s). All I need...
I'm using my TI-84 plus calculator trying to figure out the critical value(s). All I need to know is how to do the problem on the calculator. I have tried everything. I did (area/2 and Df= 99) that was wrong) then I tried (1-area and Df= 99) that was wrong to) I tried it other ways and can't seem to get it down. I just need somebody to explain it to me step by step on how they got it....
I'm trying to decide if I want to invest in a refinery to upgrade my bitumen...
I'm trying to decide if I want to invest in a refinery to upgrade my bitumen to oil. Currently it costs me $40, to get my bitumen to market, where I am able to sell it for $50 a barrel. If I decided to upgrade, it will costs me an extra $6 a barrel, these will produce 30 liters of oil, which I can sell for $2 each.   Should I expand my business? Select one: a. Yes - 4 b....
I'm trying to figure out the enthalpy of fusion, then compare it to the enthalpy fusion...
I'm trying to figure out the enthalpy of fusion, then compare it to the enthalpy fusion of ice, for an experiment that I did in a class the other day. It's really confusing me! The process involved placing ice into a calorimeter with room temperature water inside of it, then recording the change in temperature over a period of time. Thanks for the help. Calorimeter mass = 7.96g Calorimeter sp.heatcapacity = 3.3J/gK Calorimeter temp change = (21.2C - 13.1C) Ice...
XML and XSL I'm trying to style my XML code but it's not implementing the XSL...
XML and XSL I'm trying to style my XML code but it's not implementing the XSL file when I run it even though the file is referenced. Any help? XML code: <?xml version="1.0"?> <?xml-stylesheet href="textbooks.xsl" type="text/xsl" ?> <textbooks> <textbook> <title> Introduction to Design and Analysis of Algorithms</title> <authors> <author> <firstName>Anany</firstName> <lastName>Levitin</lastName> </author> </authors> <publisher> <name>Ed, Pearson</name> <website>https://www.pearson.com</website> </publisher> <Year-of-Publication>2011</Year-of-Publication> <ISBN>978-0132316811</ISBN> <book-specific-website></book-specific-website> <edition>3rd edition</edition> <cover-type>Paperback</cover-type> </textbook> <textbook> <title>Software Engineering: A Practitioner’s Approach</title> <authors> <author> <firstName>Roger</firstName> <lastName>Pressman</lastName> </author> </authors> <publisher> <name>Ed, McGraw-Hill</name>...
Hello! I'm trying to work on a python lab in my class, and we basically have...
Hello! I'm trying to work on a python lab in my class, and we basically have to make this method play_interactive Now for the fun bit. The function play_interactive will take just one argument --- the length of patterns to use as keys in the dictionary --- and will start an interactive game session, reading either '1' or '2' from the player as guesses, using the functions you wrote above and producing output as shown in the sample game session...
Below is a chart I'm trying to fill out for Invertebrates. I wanted to know if...
Below is a chart I'm trying to fill out for Invertebrates. I wanted to know if my answers are correct, and if you can help me fill in the sections that I didn't understand (the blank parts). Thank you! Characteristic Cnidaria Nematoda Platyhelminthes Arthropoda Annelida Porifera Echinodermata Protostome/mouth Eumatozoa Protostome Protostome Protostome Protostome Parazoa Deuterostome Radial symmetry Radial bilateral bilateral bilateral bilateral No symmetry (only sponges) radially symmetrical Monoecious Budding Dioecious Monoecious Dioecious Both Monoecious and Dioecious Monoecious Dioecious Cuticle/exoskeleton...
I'm trying to figure out how did they come up with the answer for the Test...
I'm trying to figure out how did they come up with the answer for the Test Value, and P Vaule. With this in formation provided. is there a formula to figuring out this problem. Parameter and Hypothesis:  What is the true percentage of all my Facebook Friends who would identify summer as their favorite season?  Hypothesis (po) = 50% Test Value:  -1.15 po=.50 p (p-hat) = .463 n = 242 P-Value:  0.2502 I want to know the process of how...
I'm trying to study for my General Chemistry II Exam, but I want to make sure...
I'm trying to study for my General Chemistry II Exam, but I want to make sure that I don't miss anything important! If you could provide your input on the following concepts, that would be greatly appreciated! Thank you so much!(: Chapter 17 – Chemical Equilibrium I. Chemical Equilibria             A. Equilibrium constant             B. Homogeneous equilibria             C. Heterogeneous equilibria             D. Molar concentrations             E. Contribution of a pure liquid or a pure solid to the equilibrium constant...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT