|
Ok I see a few possible problems with this code:
1) for each string that you split you recreate you're textfile (you call the function writetofile in you're for lus this is not needed and will only consume rescourses
just put
sweehin18 wrote: Dim objConvertText As ConvertText 'obj means object
objConvertText = New ConvertText 'create new object from class
sweehin18 wrote: objConvertText.WritetoFile(content)
behind the for lus
2) in you're writetofile function you use owrite.writeline(content) this will always automaticly create a new line if you don't want this use owrite.write(content)
(this is probably the cause of you're problem)
hope this helps
|
|
|
|
|
The content string you are assembling will always start and end with a space;
splitting it by space will result in an empty first and empty last item, each generating
an empty line.
Solution: trim content variable !
|
|
|
|
|
To make the text write from first line to second line, I use VbNewLine. However, it will write from first line to third line or even fourth line. In between the line, the blank lines are exists. Even i use trim, the problem still exists. Anyone can help?
|
|
|
|
|
you start with
content = " "
why ? that's already one empty line explained
For j = 0 To UBound(columnsplit)
...
content += (columnsplit(j)) & " "
so you end on a space too
that's another empty line explained
solution: trim content variable !
|
|
|
|
|
My program need to extract the data from certain column. For example, there is column A ,B ,C ,D over there. Orginally, the space between A and B is 2 X " " (2 blank space), space between B and C is 3X " " (3 blank space), space between C and D is 4X " " (4 blank space). I got use the coding
Dim fnaildelimiter As String
fnaildelimiter = " "
Dim fnailcolumnsplit() = Split(content, fnaildelimiter)
If i want to extract data from column A, how i shoud do it? When i use for loop like
For fnailcounter = 0 To (UBound(fnailcolumnsplit))
ColumnCotent += Trim(fnailcolumnsplit(fnailcounter))& vbNewLine
fnailcounter=fnailcounter+4' 4 is the distance from first line of column A until second line of column A.
Next fnailcounter
It gave me different things. It will count the blank space also. Therefore, column A may have data from different column and space (which produce a lot of blank for me). U got any suggestions or different ways to do it?
Yesterday, i tried whole night until afternoon, use a lot of stupid method, still cannot extract it correctly . Pls help.
|
|
|
|
|
Hi,
you dont seem to understand how Split works; when you split the 5-character string " A B "
(that is SPACE A SPACE B SPACE)
by spaces you get four parts: "" (that is an empty one), an "A", a "B", and "" (another
empty one).
It you first TRIM (there is a method to do that) " A B " what is left is "A B"; if you
split that by spaces you get "A" and "B", so TWO part. (two less, you are not getting the
first and last, empty, parts any more).
If this is not clear, read up on it and do some experiments; if you dont see the spaces
that well, try using another separator character (not that it matters).
|
|
|
|
|
Dim fnaildelimiter As String
fnaildelimiter = " "
Dim fnailcolumnsplit() = Split(trim(content), fnaildelimiter)
Split like the coding above
|
|
|
|
|
I will not spoon feed you any longer. You have been given all the necessary information.
If something is not clear, read up on it, do some experiments and look at the
intermediate values, not just the end result.
If that is too hard for you, I suggest you do something completely different...
|
|
|
|
|
i was creating a class in my code behind file of form .
at the form load , i got the following error,
An error occurred creating the form. See Exception.InnerException for details. The error is: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
Hi,
I am trying to make a user control which gives the look of a postage stamp (with jagged edges). I am doing this by overloading the OnPaint event and drawing in it. But despite specifying the pen color as transparent, the control still doesnt appear see thru where I draw the shape. I have even tried specifying the color as black and setting the container forms transparencyKey property to black. Here is the code i am putting into the OnPaint Event:
Dim graphics As Graphics = e.Graphics
Dim penWidth As Integer = 30
Dim pen As Pen = New Pen(Color.Transparent, 30)
Dim fontHeight As Integer = 10
Dim font As Font = New Font("Arial", fontHeight)
'Dim brush As SolidBrush = New SolidBrush(BackgroundColor)
'Fetch the heights and widths
Dim controlHeight As Integer = Me.Size.Height
Dim controlWidth As Integer = Me.Size.Width
Dim initialHeight As Integer = 0
Dim initialWidth As Integer = 0
Dim goLeft As Boolean = False
'Start drawing a jagged edge from the top left corner to the bottom left
While controlHeight >= 0
If goLeft = True Then
graphics.DrawLine(pen, initialHeight, initialWidth, initialHeight + 10, initialWidth + 10)
'Set them to the new starting point
initialHeight = initialHeight + 10
initialWidth = initialWidth + 10
'Now set goleft to false
goLeft = False
Else
graphics.DrawLine(pen, initialHeight, initialWidth, initialHeight + 10, initialWidth - 10)
'Set them to the new starting point
initialHeight = initialHeight + 10
initialWidth = initialWidth - 10
'Now set goleft to false
goLeft = True
End If
'Dencrement the counter
controlHeight = controlHeight - 10
End While
Thanks in advance for any help!
|
|
|
|
|
If you're trying to do what I think you're trying it might be best to you the region methode
just create a regionpath and set the region of you're usercontrol to it
you're regionpath would be the same as you're path you draw for the jagged edge (so you can use that code)
also this will make sure that when you're user clicks just outside of the edge it will not fire the onclick of you're usercontrol and you will not have to worry about seeing the usercontrol behind you're jagged edge
hope this helps
|
|
|
|
|
Hey,
It worked! Thanks alot!
|
|
|
|
|
always pleased to help someone
|
|
|
|
|
|
Sorry I pressed the enter button one too many time
|
|
|
|
|
ASPnoob wrote: Sorry I pressed the enter button one too many time
No worries, it happens sometimes
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
i am facing a problem in two dimensional array, i found the substitute of two dimensional array.i.e list class.
i was trying to add the items in the following manner.
dim s as new list(type of string)
s.add("svsfv","ssfvs")
but it takes one parameter .
is there any way to accomplish it using two paramaters, or any alternative ?
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
A two dimensional array is created via a list of lists, assuming you want to create it using dynamic containers, instead of a 2D array.
list(type of list(type of string ) )
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
if u please provde me an example to implement the two dimensional or list class.
Thanks....
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
Create lists of strings, and then add them to the main list that I showed you how to create above. A 2D array is probably a lot simpler, if you want it to be fixed size.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
list containe value and key parameters.
and i want to pass both the paraeters at rutime.(both are dynamic).
in that case how i will get to know the key name?
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
In that case, what you really want is a dictionary, which is an associative container.
If you don't know the key name, why are you looking up a value based on that key ? You can only look up a value where you know the key or index. You can iterate over all keys in a dictionary, but you need some way of knowing which one you wanted.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Your code didn't create a two dimensional array. You created an instance of a List, which is not an array, but a collection.
To create a 2 dimensional array, it's simple:
Dim myArray(10, 50) As String
Creates an array of 10 rows, with 50 columns each.
I seriously suggest picking up a book or two on VB.NET for beginners. This is a concept that's usually covered in week 2 of any VB.NET 101 course.
|
|
|
|
|
I have a solution that has around 150 forms. I need to make another paralell version that will change code in just around 5 forms. I want to be able to "branch" the original solution and share most of the forms and just change some.
I've tried different approachs: "linking" the files to the new project. Inheriting the original project into the new one ... nothing works smoothly.
Any thougths.
Thanks.
Salvador
|
|
|
|
|
I think you want one solution with three projects:
- app1 (EXE file)
- app2 (EXE file)
- whatever is common to both (a class library, hence DLL file)
|
|
|
|