{"id":10367,"date":"2022-09-23T13:06:53","date_gmt":"2022-09-23T07:36:53","guid":{"rendered":"https:\/\/jassweb.com\/solved\/solved-how-to-approach-write-a-windows-application-that-accepts-any-number-of-positive-values-closed\/"},"modified":"2022-09-23T13:06:53","modified_gmt":"2022-09-23T07:36:53","slug":"solved-how-to-approach-write-a-windows-application-that-accepts-any-number-of-positive-values-closed","status":"publish","type":"post","link":"https:\/\/jassweb.com\/solved\/solved-how-to-approach-write-a-windows-application-that-accepts-any-number-of-positive-values-closed\/","title":{"rendered":"[Solved] How to approach: Write a Windows application that accepts any number of positive values [closed]"},"content":{"rendered":"<p> [ad_1]<br \/>\n<\/p>\n<div id=\"answer-14807121\" class=\"answer js-answer accepted-answer js-accepted-answer\" data-answerid=\"14807121\" data-parentid=\"14806503\" data-score=\"0\" data-position-on-page=\"1\" data-highest-scored=\"1\" data-question-has-accepted-highest-score=\"1\" itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n<div class=\"post-layout\">\n<div class=\"votecell post-layout--left\"><\/div>\n<div class=\"answercell post-layout--right\">\n<div class=\"s-prose js-post-body\" itemprop=\"text\">\n<p>Though I don&#8217;t understand the project in entirety. This should at least point you in a solid direction.<\/p>\n<ol>\n<li>Open Visual Studio<\/li>\n<li>Select C#<\/li>\n<li>Choose Windows Form Application<\/li>\n<\/ol>\n<p>At this point your project will open with a canvas, in designer mode.  To help describe what is happening <code>click<\/code> the <code>Form<\/code> once.<\/p>\n<p>On the right-hand side of your Window you will see <code>Solution Explorer<\/code> and <code>Properties<\/code>.<\/p>\n<p>Solution Explorer: This will show you the contents of your project.  It contains the following:<\/p>\n<ul>\n<li>Properties: <code>Assembly<\/code>, <code>Resource<\/code>, and <code>Settings<\/code> information.<\/li>\n<li>References: This will contain all your project references, <code>Assemblies<\/code> that help expand your project or link to other applications you may be doing.<\/li>\n<\/ul>\n<p>The next item, is going to be your <code>Form<\/code>.  This is the most important part; because this will be where all your manipulation will be. <\/p>\n<p>Now the second item I mentioned; <code>Properties<\/code>.  Not the one in <code>Solution Explorer<\/code> but the tab that stands apart.  Will show you all the modifications for that component.  In this case, your <code>Form<\/code>.<\/p>\n<p>On the left-hand side what you&#8217;ll do is actually go to <code>Toolbox<\/code>.  These are all the components that Microsoft provides you right out of the gate.  Simply drag the <code>Textbox<\/code> Component out of the <code>Toolbox<\/code> onto your <code>Form<\/code> (canvas).<\/p>\n<p>You&#8217;ll notice the outline, with several <code>transformation<\/code> dots for you to manipulate location and dimensions. <\/p>\n<p>Before we move further I&#8217;ll break it down what has happened.  You&#8217;ve input a blank <code>textbox<\/code> onto your <code>Form<\/code>.  By default it will be called <code>TextBox1<\/code>.  It is good practice to identify the component with what it is then it&#8217;s desired function. If your looking for lets say a users first name, name it <code>txtFirst<\/code>.  That way it is easier to understand what your manipulating.<\/p>\n<p>Since my goal is to help point you in the right direction, follow these steps:<\/p>\n<ol>\n<li>Drag a <code>Label<\/code>&#8211; Name it <code>lblInput<\/code> (Change text to name of your choice).<\/li>\n<li>Drag out a <code>Textbox<\/code>&#8211; Name it <code>txtInput<\/code>. <\/li>\n<li>Drag out a <code>Rich Textbox<\/code> &#8211; Name it <code>rtxtDisplay<\/code>.<\/li>\n<\/ol>\n<p>Now these three components will inherently be your <code>User Interface<\/code>. All of the interaction will occur here.  But we are missing one <code>Element<\/code> to the interface.  A button, this is important because it will create what is called an <code>Event<\/code>.  These will essentially notify the interface of a change so it appears that it is doing something.<\/p>\n<ul>\n<li>Drag a <code>Button<\/code> out of the Toolbox, name is <code>btnAdd<\/code>. <\/li>\n<\/ul>\n<p>Now you have an entire interface; so now double click on the button.  Your screen will now change; you&#8217;ll see all of this text.<\/p>\n<p>The important part is where it navigated you to by selecting the button.<\/p>\n<pre><code>private void btnAdd_Click(object sender, EventArgs e)\n{\n     \/\/ Implementation Here.\n}\n<\/code><\/pre>\n<p>So that will provide you the <code>Event<\/code> so you can perform your logic to create your application.  Now, I&#8217;m not going to do your code for you.  But I&#8217;ll do something close so you can adapt and learn.<\/p>\n<pre><code>private void btnAdd_Click(object sender, EventArgs e)\n{\n    \/\/ Method One: \"Casting\"\n    \/\/ By default txtInput is a String, you require integers.  So you can add.\n    \/* So you would want to ensure proper Error Handling exists, otherwise when you cast you'll receive an invalid cast exception. *\/\n    txtInput.Text = (int)data;\n}\n<\/code><\/pre>\n<p>So as you can see the <code>\/\/<\/code> and <code>\/*<\/code> are different methods to comment to make your logic easy to understand.  I&#8217;m using it to explain what is happening for you.  The <code>txtInput.Text<\/code> takes whatever input <code>string<\/code> value and is now being <code>casted<\/code> to an <code>integer<\/code>.  <\/p>\n<pre><code>private void btnAdd_Click(object sender, EventArgs e)\n{\n     \/\/ Method Two: \"Array\"\n     int[] data;\n}\n<\/code><\/pre>\n<p>Now, this will actually allocate a reference in your memory.  Which will allow you to store multiple things into the <code>Array<\/code>.  This method would work well if you pass all your <code>textbox<\/code> input into your <code>Rich Textbox<\/code>.  Then a second button could fill the array to add each item.<\/p>\n<p>In this example I will actually write an entire aspect but as I stated you&#8217;ll need to do certain things to make it meet your needs.<\/p>\n<pre><code>public partial class Form1 : Form\n{\n   \/\/ Create Storage\n   List&lt;string&gt; store = new List&lt;string&gt;();\n\n   private void button1_click(object sender, EventArgs e)\n   {\n       \/\/ Will add the input of the textbox to list each time button clicked.\n       store.Add(textbox1.Text);\n   }\n\n   private void button2_click(object sender, EventArgs e)\n   {\n       \/\/ Logic to Add the items.\n   }\n}\n<\/code><\/pre>\n<p>There is half your battle right there.  Things to help you truly understand this conceptually, will be these items to help you complete your project.<\/p>\n<ul>\n<li><code>Casting<\/code><\/li>\n<li><code>Arrays<\/code><\/li>\n<li><code>Generics<\/code><\/li>\n<li><code>Loops<\/code><\/li>\n<\/ul>\n<p>Hopefully that helps you.  Those are some basic lessons; I might suggest the entry level tutorial courses on MSDN.<\/p>\n<\/p><\/div>\n<div class=\"mt24\"><\/div>\n<\/div>\n<p>            <span class=\"d-none\" itemprop=\"commentCount\"><\/span> <\/p><\/div>\n<\/div>\n<p>[ad_2]<\/p>\n<p>solved How to approach: Write a Windows application that accepts any number of positive values [closed] <\/p>\n","protected":false},"excerpt":{"rendered":"<p>[ad_1] Though I don&#8217;t understand the project in entirety. This should at least point you in a solid direction. Open Visual Studio Select C# Choose Windows Form Application At this point your project will open with a canvas, in designer mode. To help describe what is happening click the Form once. On the right-hand side &#8230; <a title=\"[Solved] How to approach: Write a Windows application that accepts any number of positive values [closed]\" class=\"read-more\" href=\"https:\/\/jassweb.com\/solved\/solved-how-to-approach-write-a-windows-application-that-accepts-any-number-of-positive-values-closed\/\" aria-label=\"More on [Solved] How to approach: Write a Windows application that accepts any number of positive values [closed]\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[320],"tags":[324],"class_list":["post-10367","post","type-post","status-publish","format-standard","hentry","category-solved","tag-c"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>[Solved] How to approach: Write a Windows application that accepts any number of positive values [closed] - JassWeb<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jassweb.com\/solved\/solved-how-to-approach-write-a-windows-application-that-accepts-any-number-of-positive-values-closed\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[Solved] How to approach: Write a Windows application that accepts any number of positive values [closed] - JassWeb\" \/>\n<meta property=\"og:description\" content=\"[ad_1] Though I don&#8217;t understand the project in entirety. This should at least point you in a solid direction. Open Visual Studio Select C# Choose Windows Form Application At this point your project will open with a canvas, in designer mode. To help describe what is happening click the Form once. On the right-hand side ... Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jassweb.com\/solved\/solved-how-to-approach-write-a-windows-application-that-accepts-any-number-of-positive-values-closed\/\" \/>\n<meta property=\"og:site_name\" content=\"JassWeb\" \/>\n<meta property=\"article:published_time\" content=\"2022-09-23T07:36:53+00:00\" \/>\n<meta name=\"author\" content=\"Kirat\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kirat\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-approach-write-a-windows-application-that-accepts-any-number-of-positive-values-closed\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-approach-write-a-windows-application-that-accepts-any-number-of-positive-values-closed\/\"},\"author\":{\"name\":\"Kirat\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31\"},\"headline\":\"[Solved] How to approach: Write a Windows application that accepts any number of positive values [closed]\",\"datePublished\":\"2022-09-23T07:36:53+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-approach-write-a-windows-application-that-accepts-any-number-of-positive-values-closed\/\"},\"wordCount\":636,\"publisher\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\"},\"keywords\":[\"c++\"],\"articleSection\":[\"Solved\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-approach-write-a-windows-application-that-accepts-any-number-of-positive-values-closed\/\",\"url\":\"https:\/\/jassweb.com\/solved\/solved-how-to-approach-write-a-windows-application-that-accepts-any-number-of-positive-values-closed\/\",\"name\":\"[Solved] How to approach: Write a Windows application that accepts any number of positive values [closed] - JassWeb\",\"isPartOf\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#website\"},\"datePublished\":\"2022-09-23T07:36:53+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-approach-write-a-windows-application-that-accepts-any-number-of-positive-values-closed\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/jassweb.com\/solved\/solved-how-to-approach-write-a-windows-application-that-accepts-any-number-of-positive-values-closed\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-approach-write-a-windows-application-that-accepts-any-number-of-positive-values-closed\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/jassweb.com\/solved\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[Solved] How to approach: Write a Windows application that accepts any number of positive values [closed]\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/jassweb.com\/solved\/#website\",\"url\":\"https:\/\/jassweb.com\/solved\/\",\"name\":\"JassWeb\",\"description\":\"Build High-quality Websites\",\"publisher\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/jassweb.com\/solved\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\",\"name\":\"Jass Web\",\"url\":\"https:\/\/jassweb.com\/solved\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png\",\"contentUrl\":\"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png\",\"width\":693,\"height\":132,\"caption\":\"Jass Web\"},\"image\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31\",\"name\":\"Kirat\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1776403586\",\"contentUrl\":\"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1776403586\",\"caption\":\"Kirat\"},\"sameAs\":[\"http:\/\/jassweb.com\"],\"url\":\"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[Solved] How to approach: Write a Windows application that accepts any number of positive values [closed] - JassWeb","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jassweb.com\/solved\/solved-how-to-approach-write-a-windows-application-that-accepts-any-number-of-positive-values-closed\/","og_locale":"en_US","og_type":"article","og_title":"[Solved] How to approach: Write a Windows application that accepts any number of positive values [closed] - JassWeb","og_description":"[ad_1] Though I don&#8217;t understand the project in entirety. This should at least point you in a solid direction. Open Visual Studio Select C# Choose Windows Form Application At this point your project will open with a canvas, in designer mode. To help describe what is happening click the Form once. On the right-hand side ... Read more","og_url":"https:\/\/jassweb.com\/solved\/solved-how-to-approach-write-a-windows-application-that-accepts-any-number-of-positive-values-closed\/","og_site_name":"JassWeb","article_published_time":"2022-09-23T07:36:53+00:00","author":"Kirat","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Kirat","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jassweb.com\/solved\/solved-how-to-approach-write-a-windows-application-that-accepts-any-number-of-positive-values-closed\/#article","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/solved-how-to-approach-write-a-windows-application-that-accepts-any-number-of-positive-values-closed\/"},"author":{"name":"Kirat","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31"},"headline":"[Solved] How to approach: Write a Windows application that accepts any number of positive values [closed]","datePublished":"2022-09-23T07:36:53+00:00","mainEntityOfPage":{"@id":"https:\/\/jassweb.com\/solved\/solved-how-to-approach-write-a-windows-application-that-accepts-any-number-of-positive-values-closed\/"},"wordCount":636,"publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"keywords":["c++"],"articleSection":["Solved"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/jassweb.com\/solved\/solved-how-to-approach-write-a-windows-application-that-accepts-any-number-of-positive-values-closed\/","url":"https:\/\/jassweb.com\/solved\/solved-how-to-approach-write-a-windows-application-that-accepts-any-number-of-positive-values-closed\/","name":"[Solved] How to approach: Write a Windows application that accepts any number of positive values [closed] - JassWeb","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/#website"},"datePublished":"2022-09-23T07:36:53+00:00","breadcrumb":{"@id":"https:\/\/jassweb.com\/solved\/solved-how-to-approach-write-a-windows-application-that-accepts-any-number-of-positive-values-closed\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jassweb.com\/solved\/solved-how-to-approach-write-a-windows-application-that-accepts-any-number-of-positive-values-closed\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/jassweb.com\/solved\/solved-how-to-approach-write-a-windows-application-that-accepts-any-number-of-positive-values-closed\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/jassweb.com\/solved\/"},{"@type":"ListItem","position":2,"name":"[Solved] How to approach: Write a Windows application that accepts any number of positive values [closed]"}]},{"@type":"WebSite","@id":"https:\/\/jassweb.com\/solved\/#website","url":"https:\/\/jassweb.com\/solved\/","name":"JassWeb","description":"Build High-quality Websites","publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jassweb.com\/solved\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/jassweb.com\/solved\/#organization","name":"Jass Web","url":"https:\/\/jassweb.com\/solved\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/","url":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","contentUrl":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","width":693,"height":132,"caption":"Jass Web"},"image":{"@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31","name":"Kirat","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/image\/","url":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1776403586","contentUrl":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1776403586","caption":"Kirat"},"sameAs":["http:\/\/jassweb.com"],"url":"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/"}]}},"_links":{"self":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/10367","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/comments?post=10367"}],"version-history":[{"count":0,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/10367\/revisions"}],"wp:attachment":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/media?parent=10367"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/categories?post=10367"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/tags?post=10367"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}