• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 799
  • Last Modified:

SetFieldWidths problem

Hi
I need some help with the SetFieldWidths in  Microsoft.VisualBasic.FileIO.FieldType.FixedWidth

Can I pass a variable to the SetFieldWidths insted of hardcode it

Now i have  Reader.SetFieldWidths(5, 10, 11, -1)

but I want to make a function for this so I need to set the parameters dynamic.

is this possible?

0
AWestEng
Asked:
AWestEng
  • 3
  • 3
1 Solution
 
chinu1310Commented:
Simply create variable and pass them as parameter.
0
 
AWestEngAuthor Commented:
I need one varible, and how should I pass i it to  Reader.SetFieldWidths(...


0
 
chinu1310Commented:
Reader.SetFieldWidths(5, 10, 11, -1)

In this what parameter you want dynamic ?
create variable say int a

If its user input let it be from some textbox.

And than pass like Reader.SetFieldWidths(a, 10, 11, -1)
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
AWestEngAuthor Commented:
that dosent work.. i nedd to pas

one time 10 one time 100 one time 1 and so on
0
 
AWestEngAuthor Commented:
I need to pass a array
0
 
chinu1310Commented:
Ohh ok.

than you can declare an array with prefix values.
At first time take first value from array.
this way

Reader.SetFieldWidths(a[i], 10, 11, -1)
Immediately after that increase the value of i.
(Initially i should be 0).

next time whey you use this  

Reader.SetFieldWidths(a[i]...

It would be a[2]


0
 
SanclerCommented:
       Dim arr As Integer = {1, 3, 9, -1}
        Reader.SetFieldWidths(arr)

Or

        Dim arr(3) As Integer
        arr(0) = 1
        arr(1) = 3
        arr(2) = 9
        arr(3) = -1
        Reader.SetFieldWidths(arr)

Or similar

Roger
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now