|
thanks for the next varsion.
I will try ur code and let u know.
this is how i wrote "CREATED_DATE" in the header line:
inputLine = sr.ReadLine()
sw.WriteLine(inputLine & Space(5) & "CREATED_DATE") ' first header line
|
|
|
|
|
It works as you said...
The header lines are written only for the first file.
Its difficult to determine the column position,because there are n number of files and hardcoding will not help in that case.
Anyways thanks for all the support and patience u had to help me.
|
|
|
|
|
Using VBScript in .NET code?? I seriously have to question your friend's abilities.
|
|
|
|
|
Can i ask what must i enter to check if my port is open? Cause port.open = true is not able to use in this case. thanks.
|
|
|
|
|
what about
serialport.isopen = true
sorry i see someone just beet me to it
modified on Monday, May 4, 2009 4:30 AM
|
|
|
|
|
in .net its
SerialPort1.IsOpen
Use the IsOpen property of the serialPort object
Hope this helps
-Regards
Bharat Jain
bharat.jain.nagpur@gmail.com
|
|
|
|
|
Thanks a lot ppl.. It helps..
|
|
|
|
|
Problem in opening the visual data manager in visual basic project. I recieves the message "looking for object with ProgID: Visdata.visdataclass"
|
|
|
|
|
I would suggest that you reinstall.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
hello i am new to code project and new to visual basic so please be patient with what im sure is a pretty tedious question
I have searched high and low to find an answer to this but figuring out what to type into MSDN or Google to get relevant answers is tying my head in knots
I am trying to write a graphing component but the grid never lines up with the picture box i am trying to draw it in, and i have distilled the problem down to this
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
PictureBox1.BorderStyle = BorderStyle.FixedSingle
PictureBox1.BackColor = Color.White
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim line As System.Drawing.Graphics
Dim pen As System.Drawing.Pen = Pens.Black
line = PictureBox1.CreateGraphics
line.DrawLine(pen, PictureBox1.Left, PictureBox1.Bottom, PictureBox1.Right, PictureBox1.Top)
End Sub
End Class
but when i run this code the line does not start in the bottom left and stop at the top right of the picture box
so how do i fix this and how do i make the solution resolution and maximize\minimize safe
thanks
modified on Monday, May 4, 2009 3:41 AM
|
|
|
|
|
Wankel Maggot wrote: line = PictureBox1.CreateGraphics
At this point, your code is utterly broken. Ditch this. NEVER use CreateGraphics again, except for rubber bands. The picture box is a waste of time, and you're not even using it as a picture box, so, the whole thing is useless.
Handle your paint event, and draw your graph directly onto your form, or into a panel if you prefer.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
ok well that doesn't really tell me what the issue is
if i do the same thing in a form will the top be the top,and the left be the left ,or am i over looking something else ,are controls in forms true to the dimensions they report
whats wrong with the create graphics ? why do they have it if it's so bad i should NEVER use it
handle my paint event?
I do appreciate the help please don't take all the questions as me tearing your advice down ,i am just very new to all this
|
|
|
|
|
Wankel Maggot wrote: ok well that doesn't really tell me what the issue is
I am not sure why you have an issue with alignment, I suspect that the issue is that you're not correctly working out where the top and left of the picture box is, and so drawing directly on the form will fix that.
Wankel Maggot wrote: whats wrong with the create graphics
It creates a graphics object out of thin air. It is not called by the WM_PAINT event. Therefore, if you draw your form with it, and then your form gets hidden ( such as being minimised, or another form being dragged over it ), when your form reappears, what you drew will be gone.
Wankel Maggot wrote: why do they have it if it's so bad i should NEVER use it
It's useful for drawing things you WANT to disappear, such as a rubber band, which is why I said that's where you could use it.
Wankel Maggot wrote: handle my paint event?
Your form has events, they are listed in the designer, if you click on the little thunderbolt icon. The paint event is where windows tells you form to draw itself, when it is first shown, when it becomes visible after being hidden, etc.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Hi,
1. Christian is absolutely right. Take his advice.
2.
Wankel Maggot wrote: line = PictureBox1.CreateGraphics
line.DrawLine(pen, PictureBox1.Left, PictureBox1.Bottom, PictureBox1.Right, PictureBox1.Top)
"line" (what a silly name) is a Graphics that has a coordinate system relative to its top left corner
so PictureBox1.Left and Bottom are irrelevant inside of it.
3.
A Graphics object is expensive (i.e. large memory footprint, and slow to create).
If you create it, you must dispose of it.
That too will be handled automatically inside a Paint handler, when you don't use CreateGraphics any more!
|
|
|
|
|
ok well the code in the example was just a quick mock up of the crux of the issue, and i didn't want variable names that implied i had a heap of code elsewhere which may be contributing to the problem that i wasn't showing you guys , so you got "line" lol
I figured out that everything is referenced from the top left but I still thought if you said box.bottom that would return a real screen point ,it still seems strange to me that this isn't the case however
the rubber band thing makes sense now you have put it in some context , i had noticed that the drawings would disappear if you waved another form over the top
because i am working on a graphing control how would i make the the plotted line disappear when i want to change the data being plotted if I use the paint event ,without losing the whole graph as Luc points out graphics are expensive and can take a moment to generate,which is why I swapped from the line shape control as that seemed to take a particularly long time to draw a lot of lines
which prompts the question how do you know when your starting out that your using the right tool for the job , its quite frustrating to write a heap of code only to find that the tool your using doesn't quite do it (line shape!),then you jump on the net and do a bit of homework and start again with a code example that uses create.graphics within a picture box ,and now obviously that wasnt the way forward ,so its time to start again
I see the paint event in the events list I will look into coding within that tomorrow
thank you so much for the advice ,at least I have a place to continue on with (start again)
|
|
|
|
|
Showing fake code when you have a problem does not make sense to me, it just wastes everyone's time.
Wankel Maggot wrote: as Luc points out graphics are expensive
No I said a Graphics is expensive, that is an instance of class Graphics. Not the few tens or hundreds of lines you are probably drawing.
|
|
|
|
|
Wankel Maggot wrote: I still thought if you said box.bottom that would return a real screen point ,it still seems strange to me that this isn't the case however
It is a real point, it's the bottom of the picture box, where-ever that is, in the form.
Wankel Maggot wrote: because i am working on a graphing control how would i make the the plotted line disappear when i want to change the data being plotted
calling Invalidate() on the form causes it to redraw itself. You use variables to get the form to draw the graph inside the paint event however it is meant to be at that point in time.
Wankel Maggot wrote: how do you know when your starting out that your using the right tool for the job
Buy a book, read MSDN, etc. I don't know why so many people use CreateGraphics, it seems to be a point of ignorance that has really taken off, which I assume means that you've googled and found examples of people doing this. A book is your best bet, because unlike a forum post, it's been edited and proof read.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
ok well thanks for your help
also are you serious Luc,it isn't "fake code" it is exactly my problem without the other several blocks of code that you would have had to trawl through looking for the problem ,i would have thought thats wasting your time
however in future i will post "real" code , if thats the way things are done
sorry for the noob posting errors
also one last question which line drawing tool would you use within the paint event
or do i use the same drawing tool as in the code example ,but use the paint event as the constructor
sorry if my terminology is not correct
modified on Monday, May 4, 2009 6:36 AM
|
|
|
|
|
You use the same "drawing tool". The system is just passing you the Graphics object you should use.
|
|
|
|
|
Hi,
Kindly let me know that, which library/refrence will be used to use filestream and
streamReader ?
because when i use following command so "StreamReader" is not appearing after typing "New" !
Dim sr As New StreamReader
Thank you
(Riaz)
modified on Monday, May 4, 2009 2:19 AM
|
|
|
|
|
VB6 is out of date, and was always rubbish. You'll find it very hard to get much support if you choose not to use a real language. Even MS has not supported it for quite some time.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
you could try to first put the import statement that will bring forward the attributes of the stream reader
|
|
|
|
|
Christian is right, forget about VB6.
Please download Visual Studio 2008 (it is free), and start using .net
After that use System.IO (System.IO.StreamReader, etc.). It has everything you need to manipulate files.
My advice is free, and you may get what you paid for.
|
|
|
|
|
if you want to manipulate, read, and create ASCII and Unicode text files use FileSystemObject. For this we need to add the file reference,
Microsoft Scripting Runtime library.
There is no FileStream or StreamReader as such, you can use FileStreamObject, TextStream instead.
|
|
|
|
|
That code will not work in VB6. You'll need to use VB.NET to use that code. You can get the Express Edition for free from here[^].
|
|
|
|