|
simple
1. replace "c:\DB\Output1\outputDB.txt" to "c:\DB\Output1\outputDB.xls"
2. replace Space(x) function with chrw(9).
in the your above code.
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
Thanks for the reply.
In the above case I read the database and wrote as excel.
I would like to read a text file and write it into excel file.
|
|
|
|
|
Read the data from the text file using Streamreader.,
write the data in manner of you want , with tab delimiter.
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
Just to make sure I understand you correctly...
Do you want to pick up each line in the TextFile, and have it's contents put into a series of cells in XL where the spaces in the line are disposed of?
ie Number of children in one cell, number of balloons in next etc?
So that the cell contents are just the value as VALUE, not as TEXT?
Cos if so there are two methods, one is to just load the text into one cell and then split it via VBA in XL, or to pick up the text form the text file, scan it, apply each set of non space characters to a variable, then fire the variable into a cell in xl, continue until end of line, next line etc.
Which is the one you would like?
------------------------------------
"Possessions make you poor, wealth is measurable only in experience."
Sun Tzu 621BC
|
|
|
|
|
I want each line in the text file has to be entered in the excel based on the fields.
If the excel file field is Parent, the first field from the text file has to be entered in that cell and so on.
I want the text to be entered and not the count/number.
|
|
|
|
|
I need help with the following code. I am building a custom control. I am storing controls in arrays as I need more rows. When I type into the second text box as soon as i run the program the text is typed into the first text box. Please help. I thank you in advance.
Imports System.Drawing
Imports System.Windows.Forms
Public Class UserControl1
Dim arrText1(1), arrtext2(1) As TextBox
Public Sub SetTextBoxes()
Dim text1 As New TextBox()
With text1
.Name = "text1"
.Left = 8
.Font = New Font(.Font.Name, 14, FontStyle.Regular, .Font.Unit)
.Size = New Point(80, 30)
Me.Controls.Add(text1)
arrText1(0) = text1
End With
Dim text2 As New TextBox()
With text2
.Name = "text2"
.Left = 100
.Font = New Font(.Font.Name, 14, FontStyle.Regular, .Font.Unit)
.Size = New Point(80, 30)
Me.Controls.Add(text2)
arrtext2(0) = text2
End With
End Sub
Private Sub ucGrid_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
SetTextBoxes()
End Sub
End Class

|
|
|
|
|
The code you posted here appears to work just fine.
Whatever is causing the problem must be somewhere else.
What are the arrays for?
My advice is free, and you may get what you paid for.
|
|
|
|
|
Thanks for the fast reply. It happens only the first time you run the code and type into the second text box. Otherwise it works fine. I am using the arrays in order to have more rows in my control (sort of control array of vb6). This code works fine with my regular windows form in vb.net 2008. But it does not work in my user control form in vb.net 2008. Please help.
modified on Monday, May 18, 2009 7:48 AM
|
|
|
|
|
So apparently the error is caused by some difference between the standard windows form and your user control form.
I suppose you'll need to check what differences there are between the two.
My advice is free, and you may get what you paid for.
|
|
|
|
|
Thank you Johan. I will try to figure out the difference between both. Thanks once again.
|
|
|
|
|
Hi Johan, this is for your information. I have placed two text boxes in the user control (Design time) without any coding. Still the text i type in the second text box is getting typed in the first text box and the cursor in the second text box is moving as per the characters typed (giving out blank spaces in the first text box). Any idea what the problem could be. Do you think i should reinstall vb.net ?!
|
|
|
|
|
Hi guys,
I am importing a file and need to import the file onto a db.The problem is i am reading the file line by line and different lines may contain data that is to be inserted as one record in the db.The tag of the line helps me to know what to insert where. The problem is some lines don't have a tag and should be read as lines from the previous tag..The qsn is when do i insert the line into the db.
Here is a sample of the file.
-----------------------------------------------------------------------
:61:0807040704D370,13NTRFTT 3676//FAAM8186027286
/OCMT/EUR400,/
:86:210?00PAYMENT BY ELECTRONIC MEDIA?1097171?20/FAG:GONZALO HERNANDE
Z CIRI?21ZA/FAG:033529423T/FAG:P.O. ?22BOX 30437/FBB:EUR370,13/FU
K?23:1,/FCC:FR?32MRS KONAN IRENE/ MRS MAGGIE?33NAIROBI
:61:0807040704D700,NCHK6810021334//400877010900EUR
/OCMT/EUR700,/
:86:002?00GVC-LANGTEXT NICHT VORHANDE?1095186?20SCHECKAUSSTELLER?3066
010075?31173757?32SCHECK-NR. 0006810021334?34000
-----------------------------------------------------------
Tag (:61 contains the details of each transaction.But as you can see this transaction is contained into two lines
Tag (:86 contains info of a the owner. But as you can see this tag here contains two lines.Some records have up to 5 lines .
Any ideas will be highly appreciated.
|
|
|
|
|
The actual problem appears to be that the lines that belong together, are mixed up.
You could just create a datatable (or a temporary database table), and insert all lines separately, including the tag numbers.
Then sort the table by tag numbers, concatenate the rows where necessary, and then insert the concatenated values into the production database table.
My advice is free, and you may get what you paid for.
|
|
|
|
|
Something like (with possible syntax errors ):
using sr as stringreader = new stringreader("MyFile)
dim inLine as string = sr.readline() 'assumes first line has tag
while sr.peek >=0
dim s as string = sr.readline
if s.startwith(":")
'write inLine as db record
inLine = s
else
inline = inLine & s
end if
end while
end using
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
|
|
|
|
|
Thanks for the reply,its been very helpful.
That should handle the first transaction block with a (":").I have a query though.See every tag(":")has its own transaction eg :61: and :86: are totally different transactions and this two should be stored in different tables in the db.What happens when i reads the next(":") and want to store it on a different table.How can i map this line to the tag that appeared just before it?
Regards
|
|
|
|
|
Would something like this do what you want?
using sr as stringreader = new stringreader("MyFile)
dim inLine as string = sr.readline() 'assumes first line has tag
while sr.peek >=0
dim s as string = sr.readline
if s.startwith(":")
'Might be possible to use Select Case instead of multiple Ifs
If inline.Startswith(":61:") then
'do 61 stuff
End if
If inline.Startswith(":86:") then
'do 86 stuff
End if
inLine = s
else
inline = inLine & s
end if
end while
end using
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
|
|
|
|
|
When i m changing my system Resoluction then my software controls are not viewing.
Suggest me how to set resoluction setting for my application.
Thanks
If you can think then I Can.
|
|
|
|
|
try out My.Computer.Screen
My advice is free, and you may get what you paid for.
|
|
|
|
|
Getting Computer Resoluction is not my Problem. My problem is that how to Manage software for diffrent resoluction and DPI.
If you can think then I Can.
|
|
|
|
|
If you can retrieve the resolution, of the screen, then you could build your GUI dynamically.
Use relational sizing for your controls (and font sizes where necessary) and add them to the form at runtime.
Alternatively you could spread out your controls over multiple forms, that you call when necessary, or over a tab control.
My advice is free, and you may get what you paid for.
|
|
|
|
|
My application is simple dialog which size is 867, 666.
but when i am changes it's DPI 120 then its Controls are not showing which are standing in the Buttom of Form.
If you can think then I Can.
|
|
|
|
|
Dim g As Graphics = Graphics.FromHwnd(Me.Handle)
MsgBox("DPI Value: " & g.DpiX.ToString())
This bit of code will get you the DPI setting of the machine your app is running on.
Maybe you can use this, when you calculate the size of your controls and fonts
My advice is free, and you may get what you paid for.
|
|
|
|
|
I am using this code.But my form height is not incresing.
If you can think then I Can.
|
|
|
|
|
I had a similar problem. Set the "AutoScaleMode" property of the form to "Off". When you change the DPI, it's auto-scaling your controls and causing them to display incorrectly.
Hope that helps,
-Ray
|
|
|
|
|
I have generate one more problem.
I am creating Control at runtime in 96 DPI it shows normally. but when i am changing DPI 120 controls are moving thereware.
If you can think then I Can.
|
|
|
|