Hi,
I'm attaching a code here.this code works successfully,
But my doubt is,
Can an arraylist store this integer value "J" as wellas string value "S"
ArrayList ArrMM=new ArrayList();
for(int j=1;j<=12;j++)
{if(j<10)
{string s="0" + j;ArrMM.Add(s); }
else {ArrMM.Add(j);} }
Can anyone help me for solving this problem?.
thanks,
Vaj. 1 3337
Hi,
The ArrayList can store any reference types and boxed value types.
Here is another way:
ArrayList ArrMM=new ArrayList();
for(int j=1;j<=12;j++)
{
ArrMM.Add(j.ToS tring("00"));
}
The ArrMM will contain 12 strings "01", "02", ... "11", "12".
In your example, the ArrMM will contain 9 strings "01", "02" .. "09" and 3
boxed integers 10, 11, 12
--
Andrew Gnenny
X-Unity Test Studio http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE
"Vaj" <vi*******@hotm ail.com> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. .. Hi, I'm attaching a code here.this code works successfully, But my doubt is, Can an arraylist store this integer value "J" as wellas string value "S" ArrayList ArrMM=new ArrayList();
for(int j=1;j<=12;j++)
{if(j<10)
{string s="0" + j;ArrMM.Add(s); }
else {ArrMM.Add(j);} }
Can anyone help me for solving this problem?.
thanks, Vaj.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Y |
last post by:
Hi I have an arraylist that contains integer values. What i want to ask you all is how i would retrieve the index values when the values have been sorted. For example..
lets assume the index values are in brackets and the values contained in it is shown immeditaly preceding it.
Arraylist1
(0)4 , (1)2, (2)1, (3)2, (4)0, (5)
i want the arraylist to now be sorted according to the values contained in it (smallest integer first)....
|
by: Fieldmedic |
last post by:
I'm attempting to get an arraylist to display in a Listbox (listbox2). The
arraylist is created from selections in a different listbox (listbox1). The
1st listbox has a selection mode of MultiExtended. Once the selection has
been made in the 1st ListBox, the user clicks on a button to generate the
arraylist using the values selected. Then click a second button to display
the arraylist contents to ListBox2. There are no errors, but all I get...
|
by: Stephen |
last post by:
I was wondering if someone can help me with an web application design
problem. I have a aspx page which builds up an arraylist called addresses
and outputs the values in the arraylist items to a datagrid. I am using the
viewstate object to store the Arraylist items on the page on postback.
My PROBLEM is that I need to redirect the user to a new aspx page and on
this new page i need to be able to access the items in my arraylist. Is this...
|
by: Mike Dole |
last post by:
I have an arraylist like the one with the Guitar Class sample in
Q316302.
Dim MycolliCol as arraylist
Private Sub FillArray()
MyColliCol.Add(New Colli(1, "STUK", 0))
MyColliCol.Add(New Colli(16, "ROL", 1))
MyColliCol.Add(New Colli(17, "BOS", 2))
MyColliCol.Add(New Colli(18, "DOOS", 0))
MyColliCol.Add(New Colli(19, "PAK", 0))
|
by: Jason Reis |
last post by:
I need to keep track of up to 100 values. When the list reaches 100, I'd
like the first to be removed and the new item added to the end. My first
thought was the Stack class, but I need to be able to update items 0-99
with updated values. The version I ended up with today is an ArrayList,
where I do...
If (myList.Count = 100) Then myList.RemoveAt(0)
myList.Add(newItem)
Does anyone have any suggestions for me? I'm not sure how...
| |
by: Dennis |
last post by:
I use the following code for a strongly typed arraylist and it works great.
However, I was wondering if this is the proper way to do it. I realize that
if I want to implement sorting of the arraylist then I have to handle this
with a sort method that uses comparer. I can reference the properties of the
Arraylist directly such as
dim mylist as new FrameList
mylist.Add(new FrameStructure)
mylist(0).first = "blabla..."
mylist(0).second...
|
by: JohnR |
last post by:
From reading the documentation, this should be a relatively easy thing. I
have an arraylist of custom class instances which I want to search with
an"indexof" where I'm passing an instance if the class where only the
"searched" property has a value. I expected to get the index into the
arraylist where I could then get the entire class instance. However, the
'indexof' is never calling my overloaded, overrides Equals method. Here is
the...
|
by: cmdolcet69 |
last post by:
Public ArrList As New ArrayList
Public bitvalue As Byte()
Public Sub addvalues()
Dim index As Integer
ArrList.Add(100)
ArrList.Add(200)
ArrList.Add(300)
ArrList.Add(400)
ArrList.Add(500)
|
by: cowboyrocks2009 |
last post by:
Hi,
I need help to automate my code to take data from input file. Also I need to create it as a function so that I can pass it to some other program. I am new to Java so having a bit limitation to do this.
My tab delimited Input File looks like this:-
21 p 13e 0 62 1 580001 andrew -14.53 -13.95 0 0
21 p 13d 63 124 580002 1160001 andrew -13.95 -13.37 0 0
21 p 12g 311 364 2900000 3385714 john -11.63 -11.14 0 0
21 q 11.1a 1274 1321...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |