473,387 Members | 1,486 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Serialization of arrays (Recipe program)

Hello, I am looking for solution that will help me to store an data in arrays, so that next time when i open program i could open it and it will be in the save form.
Serialization is the thing that I would need to do, but I really find hard to understand it, where does these variables go and how to use this process to convert data in XML or binary. Any help would be appreciated. Thanks.

Expand|Select|Wrap|Line Numbers
  1. Public Class Form1
  2.     Dim recipename As String
  3.     Dim recipeserves As Integer
  4.  
  5.     Dim ingredients(25) As String
  6.     Dim index As Integer
  7.     Dim ingredientindex As Integer
  8.     Dim ingredientquantity(25) As Integer
  9.     Dim ingredientunit(25) As String
  10.  
  11.  
  12.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  13.         recipename = InputBox("Please enter your recipe name.")
  14.         recipeserves = InputBox("Please enter serves number for this recipe.")
  15.         index = InputBox("Please enter ingredients number.")
  16.  
  17.         txtnames.Text = recipename
  18.         txtserves.Text = recipeserves
  19.  
  20.  
  21.  
  22.         'For recipe ingredients
  23.         For Me.ingredientindex = 1 To index
  24.             ingredients(ingredientindex) = InputBox("Please enter ingredient name.")
  25.             ingredientquantity(ingredientindex) = InputBox("Please enter ingredient quantity for the following ingredient.")
  26.             ingredientunit(ingredientindex) = InputBox("Please enter ingredient unit for the following ingredient")
  27.         Next
  28.         For Me.ingredientindex = 1 To index
  29.             lstbox.Items.Add(ingredients(ingredientindex))
  30.             lstbox1.Items.Add(ingredientquantity(ingredientindex))
  31.             lstbox2.Items.Add(ingredientunit(ingredientindex))
  32.         Next
  33.  
  34.  
  35.  
  36.     End Sub
  37.  
  38.     ' Dim filename As String
  39.  
  40.     ' Private Sub btnsave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsave.Click
  41.  
  42.     'Saving to text file
  43.     '    filename = InputBox("Please enter a filename")
  44.     ' FileOpen(1, filename, OpenMode.Output)
  45.     ' For Me.ingredientindex = 1 To index
  46.     '      PrintLine(1, ingredients(ingredientindex) & " " & ingredientquantity(ingredientindex) & " " & ingredientunit(ingredientindex))
  47.     '  Next
  48.     '  FileClose(1)
  49.  
  50.     ' End Sub
  51.  
  52. End Class
  53.  
Feb 16 '14 #1
0 1039

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: takashi | last post by:
Hi, I have a question. I am learning about how to use c++ language. I have attempted to make my own programs, using the knowledge that I have, but sometimes when I get stuck on writing a code, it...
3
by: Franz | last post by:
Let me describe the flow of my program first. 1. Deserialize data from xml file. 2. Addition of "PersonType" class to the AllPersonalData. 3. Serialize data back to the xml file. My question is...
7
by: jmac | last post by:
Greetings fellow programmers, I have created a C program that has a few bugs and would like to get some help with working them out. Here is a list of the problems that I am experiencing: -...
3
by: parrot toes | last post by:
Summary: I have been trying to make requests of a web service provided by Axis using a dotnet client with code generated by wsdl.exe and have been getting exceptions when trying to process the...
0
by: =?Utf-8?B?TWljaGFlbA==?= | last post by:
Hello, i have a problem with jagged arrays and a webservice. I try to call a webservice with an array of a class that contains jagged arrays. Here is an example: class MyClass{ string...
3
Blackout
by: Blackout | last post by:
Hi, I'm new to C and need to make a program that displays the output of the first six powers of 2 like this: 1 2 4 8 16 32 (2 to the power of 0, 2 to the power of 1, 2 to...
2
by: =?Utf-8?B?U3dhcHB5?= | last post by:
hi, I have a class as MyClass & SecondClass which implement IMyInterface interface. class MyClass { Private SecondClass m_SecondClass; }
5
by: aethiolas | last post by:
I have an array of string that i want to serialize to an xml file. By default .net will serialize it something something similar to this <ArrayOfStrings> <string>Testing</string>...
4
by: =?Utf-8?B?SGVucmlrIFNjaG1pZA==?= | last post by:
Hi, consider the attached code. Serializing the multi-dimensional array takes about 36s vs. 0.36s for the single-dimensional array. Initializing the multi-dimensional array takes about 4s...
3
by: erikaslt66 | last post by:
Hi, I have an assigned task to do the recipe program in school, I have been trying to solve my program in hours, but with little success... It is difficult to make it for me, because there is few...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.