|
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[^].
|
|
|
|
|
I have to writen the XML file in VB 6.0
<Globus xmlns:xsi = 'http://www.w3.org/2001/XMLSchema-instance'
xmlns = 'http://www.temenos.com/GLOBUS/OFSML/120'
xsi:schemaLocation = 'http://www.temenos.com/GLOBUS/OFSML/120 ../../xsd/ofsml.xsd'>
<ofsmlHeader xsi:nil="true" />
<serviceRequest >
<securityContext>
<userName>INPUTT</userName>
<password>123456</password>
<company>VN0010001</company>
</securityContext>
<ofsStandardEnquiry name = 'ACCOUNT-IBS'>
<selectionCriteria operand = "EQ">
<fieldName>ACCOUNT.NUMBER</fieldName>
<value>002100000415<</value>
</selectionCriteria>
</ofsStandardEnquiry>
</serviceRequest>
</Globus>
So i have written as
Dim objDOM As New MSXML2.DOMDocument30
Dim objnode As MSXML2.IXMLDOMNode
Dim objChildNode As MSXML2.IXMLDOMNode
Dim ObjServicereq As MSXML2.IXMLDOMNode
Dim objserviceCon As MSXML2.IXMLDOMNode
Dim ofsStandardEnquiry As MSXML2.IXMLDOMNode
Dim objattribute As MSXML2.IXMLDOMAttribute
Dim objattribute1 As MSXML2.IXMLDOMAttribute
Dim objattribute2 As MSXML2.IXMLDOMAttribute
Dim objelement As MSXML2.IXMLDOMElement
Dim objelement1 As MSXML2.IXMLDOMElement
Dim objattribute3 As MSXML2.IXMLDOMAttribute
Dim objattribute4 As MSXML2.IXMLDOMAttribute
Dim objattribute5 As MSXML2.IXMLDOMAttribute
' Set objNode = objDOM.createNode(NODE_PROCESSING_INSTRUCTION, "xml", "")
' objDOM.appendChild objNode
'
Set objnode = objDOM.createNode(NODE_ELEMENT, "GLOBUS", "")
Set objelement = objnode
'
Set objattribute = objDOM.createAttribute("xmlns:xsi")
objattribute.Text = "http://www.w3.org/2001/XMLSchema-instance"
objelement.setAttributeNode objattribute
'
Set objattribute1 = objDOM.createAttribute("xmlns")
objattribute1.Text = "http://www.temenos.com/GLOBUS/OFSML/120"
objelement.setAttributeNode objattribute1
Set objattribute2 = objDOM.createAttribute("xsi:schemaLocation")
objattribute2.Text = "http://www.temenos.com/GLOBUS/OFSML/120 ../../xsd/ofsml.xsd"
objelement.setAttributeNode objattribute2
'
Set objattribute = Nothing
Set objattribute1 = Nothing
Set objattribute2 = Nothing
Set objChildNode = objDOM.createNode(NODE_ELEMENT, "ofsmlHeader", "")
Set objattribute3 = objDOM.createAttribute("xsi:nil")
objattribute3.Text = "true"
Set objelement1 = objChildNode
objnode.appendChild objChildNode
objelement1.setAttributeNode objattribute3
Set objelement1 = Nothing
Set ObjServicereq = objDOM.createNode(NODE_ELEMENT, "serviceRequest", "")
objChildNode.appendChild ObjServicereq
Set objserviceCon = objDOM.createNode(NODE_ELEMENT, "securityContext", "")
Dim xmlElmName As MSXML2.IXMLDOMElement
Set xmlElmName = objDOM.createElement("userName")
objserviceCon.appendChild xmlElmName
xmlElmName.Text = "INPUTT"
Dim xmlElmPASSWORD As MSXML2.IXMLDOMElement
Set xmlElmPASSWORD = objDOM.createElement("password")
objserviceCon.appendChild xmlElmPASSWORD
xmlElmPASSWORD.Text = "123456"
Dim xmlElmcompany As MSXML2.IXMLDOMElement
Set xmlElmcompany = objDOM.createElement("company")
objserviceCon.appendChild xmlElmcompany
xmlElmcompany.Text = "VN0010001"
objnode.appendChild ObjServicereq
ObjServicereq.appendChild objserviceCon
Set objserviceCon = Nothing
Set ofsStandardEnquiry = objDOM.createNode(NODE_ELEMENT, "ofsStandardEnquiry", "")
Set objattribute4 = objDOM.createAttribute("NAME")
objattribute4.Text = "ACCOUNT-IBS"
Set objelement = ofsStandardEnquiry
objnode.appendChild ofsStandardEnquiry
objelement.setAttributeNode objattribute4
ObjServicereq.appendChild ofsStandardEnquiry
Dim objselectioncriteria As MSXML2.IXMLDOMNode
Set objselectioncriteria = objDOM.createNode(NODE_ELEMENT, "selectionCriteria", "")
Set objattribute5 = objDOM.createAttribute("Operand")
objattribute5.Text = "EQ"
Set objelement = objselectioncriteria
ObjServicereq.appendChild objselectioncriteria
objelement.setAttributeNode objattribute5
Set objelement = Nothing
Dim xmlElmfieldName As MSXML2.IXMLDOMElement
Set xmlElmfieldName = objDOM.createElement("fieldName")
objselectioncriteria.appendChild xmlElmfieldName
xmlElmfieldName.Text = "CUSTOMER.CODE"
Dim xmlElmvalue As MSXML2.IXMLDOMElement
Set xmlElmvalue = objDOM.createElement("value")
objselectioncriteria.appendChild xmlElmvalue
xmlElmvalue.Text = "100297"
objnode.appendChild ObjServicereq
objDOM.appendChild objnode
Set objelement = Nothing
Set objChildNode = Nothing
Set objselectioncriteria = Nothing
Set ofsStandardEnquiry = Nothing
Set ObjServicereq = Nothing
Set objnode = Nothing
MsgBox objDOM.xml
objDOM.save ("C:\SCBDATA\Request\Request_ACC.XML")
Debug.Print objDOM.xml
Set objDOM = Nothing
' Call GENCUST
End Sub
but i get output as
<Globus xmlns:xsi = 'http://www.w3.org/2001/XMLSchema-instance'
xmlns = 'http://www.temenos.com/GLOBUS/OFSML/120'
xsi:schemaLocation = 'http://www.temenos.com/GLOBUS/OFSML/120 ../../xsd/ofsml.xsd'>;
<ofsmlHeader xmlns = "" xsi:nil="true" />;
<serviceRequest xmlns = "" >
<securityContext>
<userName>INPUTT</userName>
<password>123456</password>;
<company>VN0010001</company>;
</securityContext>;
<ofsStandardEnquiry name = 'ACCOUNT-IBS'>
<selectionCriteria operand = "EQ">
<fieldName>ACCOUNT.NUMBER<</fieldName>
<value>002100000415</value>
</selectionCriteria>
</ofsStandardEnquiry>
</serviceRequest>
</Globus>
xmlns = "" is repeating at ofsmlheaser and service request ,.. please help me like how to write it by getting it correctly .
So please suggest me any way in VB 6.o to make the xmlns="" no get repeated for child nodes ...
|
|
|
|
|
Member 6161367 wrote: in VB 6.o
VB6 had terrible XML support, which follows, because it was a terrible joke of a language. Why are you using it ?
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 christian,
I was given this task in vb 6.0 only,So i suggest any one to tell me like what can be apossible way to stop that xmlns="" not to get repeated in other child nodes ..
Can u please suggest me some way .As we r forced to genearte a n XML file in vb 6.0 we require ur help in thsi context ...
Thanks,
Pallavi.
|
|
|
|
|
Hello Experts.
I am try to create Employee Payroll in Excel Sheet using VB.Net.
using Excel.Application, Excel.Workbook, Excel.Worksheet insert data and formatting data.
After the save this Excel Workbook.
I try to display this excel sheet in VB.NET Form.
Now my problem is I m using Web browser it is working properly.
But When i open this program other excel Book(Opened Book) is not working in Excel 2003/ not displaying and I can't open new Excel sheet using Excel 2003 Until closing my Programming.
Please Help me.
Thanks in advance.
|
|
|
|
|
I want to write an application to read data from a specific IP address and Port. I have been searching for solutions on internet and understand that I need to use TCPlistener.
- My PC will act as server or client? does it matter when i write the application?
- how can I test my Tcplistener application? I would like to send data to a port and read it using my application and send data back. Please let me know if i need to edit any setting on router as well.
thanks
chun
|
|
|
|
|