473,799 Members | 3,033 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to use a String Array for passing Values

45 New Member
Hi,

I have a simple query but im just not able to get it right.

Have a look at my sample code below
Expand|Select|Wrap|Line Numbers
  1. Sub Function1
  2.  
  3. My Code Here
  4. Function2(Year,Month)
  5.  
  6. End Sub
  7.  
  8. Sub Function2(Year,Month)
  9. Dim Str as String()
  10.  
  11. for 1 to 30
  12. Dim MyDate As New Date(Year, Month, i)
  13. Str = MyDate.DayOfWeek.ToString()
  14. Next
  15. Return Str
  16.  
  17. End Sub
  18.  
Function 2 Is used to get the Name of the Day.

Year and Month Parameter is Passed from Function 1 like this Function2(Year, Month)

My issue is

1)i want to add names of all the 30 days into one array

2)How can i return that array to Function1

3)Howe can i use that Array in Function 1 and assign each name to individual variable.

Please Suggest
Oct 21 '11 #1
1 1783
!NoItAll
297 Contributor
Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim str() as String
  3. Dim MyDate as Date
  4. for 0 to 30
  5.     Redim Preserve str(i)
  6.     try
  7.         Str(i) = MyDate.DayOfWeek.ToString()
  8.     Catch
  9.         Exit For
  10.     End try
  11. Next
  12.  
  13. Return Str
  14.  
  15.  
Check the str.length to see how many days you have - not all months have the same number of days...
Oct 21 '11 #2

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

Similar topics

1
2867
by: Rob Mayo | last post by:
How can I create a pointer to a string array from VB.Net? I want to take a string array of variable size and pass it as a wParam on a message to a custom subclassed window. I've tried wrapping the array in a structure, but I think that is to no avail because the size of the string array is variable. Dim strValues() As String = ... Dim myStruct1 As New MyStruct(strValues) Dim wParam As IntPtr = Marshal.AllocHGlobal(myStruct1)...
3
2886
by: Goh, Yong Kwang | last post by:
I'm trying to create a function that given a string, tokenize it and put into a dynamically-sized array of char* which is in turn also dynamically allocated based on the string token length. I call the function using this code fragement in my main function: --- char** arg_array; arg_count = create_arg_array(command, argument, arg_array); for(count = 0; count < arg_count; count++)
2
3646
by: Bnc119 | last post by:
Hello, I have written a C# COM server that has a few methods and a property called DataItems that returns an ArrayList. During the course of execution the ArrayList gets populated with several strings. I am having issues retrieving these strings from my C++ client. My C# code looks like this: public object DataItems { get
1
3953
by: VCVCVC VC via DotNetMonster.com | last post by:
Hi , I want to pass a string array to an unmanaged COM Componet. The component should retrieve it. Pls help me to understand with a sample code. I have declared a BSTR* myStringarr, for this in the COM component. How to retrieve values from this myStringarr? -- Message posted via http://www.dotnetmonster.com
2
1915
by: rmathieu | last post by:
Hi, I want to initialize a static String array in MC++. What I want to do is to initialize my String array like the C# way: new String {"11", "22"} but I could not find an equivalent in MC++. The onlu thing I can do is this: new String* but I cannot specified any initial values... Did someone have any ideas??? Here is an example of what I want to do: C# struct TestingStruct {
8
7461
by: barbarowa | last post by:
I've coded a script to populate a drop down menu from a database but I can't seem to get the PHP script to pass the selected item. The database only has two fields, ID and ITEM. I want the user to be able to see all the choices and pick one. This choice would then be used to update another database. The drop down menu populates correctly. When I test for the variable being passed, nothing is showing up. Here is the code: <?php
4
5528
by: Colin Williams | last post by:
Hi I have a file list box with which i am passing the selected items to a string array (using copyTo), however i also need to pass the path of the FLB with each string in the array. Is it possible to add this to each element of the array or is there another approach i could take. Thanks Colin Williams
2
2287
by: johnj | last post by:
I am converting an application I wrote in VB.NET to C#. I am not a C# guy, at all. I am having a problem passing values to a property in C#. I understand that it is probably not the best way of achieving my result, but it works in VB.NET, flawlessly. Basically, I am storing a bunch of settings in a hashtable. Then, setting/getting my values in the hastable with a public shared property. Below is the property. The function GetSetting's...
8
71618
by: Pim75 | last post by:
Hello, I'm defining a string array like: Dim strArray() As String = {"1", "2"} Can I add some values to this string array later in the code? It's not clear to me how to do this. I hope someone can help me. Thanks in advance!
3
6467
by: vidhyapriya | last post by:
Hi all I am developing windows application using vb.net.I want to pass values to open form.I am opening only one form when user click the buttons several times.Useing delegate i am passing values for first time.Next time when user click the button i want to pass value to open form.How to pass value to open form.Can anyone help me plz.Thanx in advance Code I used, Form1 Code: Public Delegate Sub GreetingDelegate(ByVal MsgString As...
0
9688
marktang
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...
0
9544
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,...
0
10259
jinu1996
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...
1
10238
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,...
0
10030
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7570
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6809
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();...
1
4145
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
3
2941
bsmnconsultancy
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...

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.