|
Get a copy of Visual Studio Express from Microsoft[^]. It's free and provides everything you need to get started. There are also hundreds of articles here on CodeProject, and in the wider community that will help you.
|
|
|
|
|
Thank you sir for your response and great suggestion - I appreciate your time!
|
|
|
|
|
If you are just starting out consider learning c# instead of VB, the reason, there are dramatically more examples and support resources for c# than there is for VB.net, unless of course your CAD application uses VB for it's scripting language.
And you still need visual studio express.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thank you sir for your response. I took a class in C 20 years ago and still have a bit of it in the back of my mind. My only problem is the CAD scripting is in VBA so I would like to learn VB if possible. Thank you for your Visual Studio Express suggestion.
|
|
|
|
|
Be a little careful that you are working with the correct platform, VBA is very different from VB.net. I would check if the CAD is using the old VBA, based on VB6 or VSTO which will be using VB.net.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thank you for your response. - CATIA is the CAD system I use - from my understanding it uses VBscript VBA and CATscript. I figure learning any VB type code will give me better skills when I go into the VBA scripting even though it is different.
Thanks
|
|
|
|
|
I would like to add everytime I mention VBA to my programing friends they all make wrinkled faces and shake their head - I realize it is a dead language but CATIA is very much alive and used by the vast majority of the aerospace biz. Thanks for your suggestions
Kaz
|
|
|
|
|
I have the following code where I am updating a new field to a Table. I tried using the NULL in my statement and it does create the field but the Allow Zero length is still false in the table.
Can anyone show me the errors of my ways?
Dim sql As String
Dim connection As OleDbConnection
Dim connetionString As String
connetionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='" & PathCMDB() & "';"
connection = New OleDbConnection(connetionString)
connection.Open()
Dim cmd As OleDbCommand = New OleDbCommand(sql, connection)
cmd.CommandText = "ALTER TABLE [Machines] ADD [CNC_Folder] Text (255) NULL"
cmd.ExecuteNonQuery()
connection.Close()
connection.Dispose()
|
|
|
|
|
|
Hmm not really I am not using ADOX. I was hoping to just change the sql statement somehow. I am just using standard OleDbConnection
|
|
|
|
|
By the looks of it, it can't be done via a SQL script. If you set the column to "NOT NULL" rather than "NULL", that should allow zero-length values. Will that be feasible, or do you absolutely have to allow both NULL and zero-length?
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
|
|
|
|
|
I have to allow both.
"So simply but yet so hard"
I guess I could always create a ADOX wrapper but I don't really want to go that way
|
|
|
|
|
May be your only option. Google it. I searched around and everything I found said that it's not possible via a SQL query script to allow NULL and zero-length.
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
|
|
|
|
|
Yeah I found the same thing when I Google it. I was hoping there was some bckdoor found by some of the GURU's here.
Thanks for you help though.
|
|
|
|
|
"Trigger".
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Trigger? Not sure what that means
|
|
|
|
|
You could write a trigger to do the validation. Not sure, but might also be done with a constraint that validates the length.
--edit;
I don't think that Access would allow the constraint-construction, I was thinking in Sql Server again. Still, Access does support triggers[^].
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Ahhh!
Am I right Eddy that there is some limitations on triggers? I thought I saw something that said you could only use framework 2, 3 or 3.5. I believe I did anyways. I would like to stick with 4.5.
|
|
|
|
|
gwittlock wrote: Am I right Eddy that there is some limitations on triggers? Not that I know, but that hardly means anything; I don't use Access that often nowadays.
gwittlock wrote: I would like to stick with 4.5. The trigger would be in the database, not in the code
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I wrote simple xml validator using XmlDocument.Validate Method (ValidationEventHandler)[^], but it isn't working as expected. My validator returns zero errors even if the xml structure does not corresponds to schema!!!
Additional information:
Compiler does not show any errors and warnings.
Code analysis does not display any issues.
The files are located in two different path:
xml = %userdocs%\MyProgramm\XML\xmlfile.xml
xsd = %userdocs%\MyProgramm\Schema\schemafile.xsd
During debug the programme, the debugger shows in this line
Dim reader As XmlReader = XmlReader.Create("contosoBooks.xml", settings)
XmlReader: {nothing} (as expected!)
and when i step into the next line
XmlReader: {none} .
Could it be the reason of issue? As per i understand MSDN documentation[^], Create method should return XmlReader object. What is going on?
[EDIT]
xml:
="1.0"
<MyTool xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Settings>
<AdReqs/>
</Settings>
</MyTool>
xsd:
="1.0"
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:MyTool">
<xs:element name="Settings">
<xs:complexType>
<xs:sequence>
<xs:element name ="AddReqs" default="Y">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Y"/>
<xs:enumeration value="N"/>
</xs:restriction>
</xs:simpleType>
</xs:element >
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Code snippet (of TXmlValidator class):
Imports System.Xml.Schema
Imports System.Xml.XPath
Imports System.Text
Public Class TXmlValidator
Implements IXmlValidator
Private vErrLst As List(Of String) = New List(Of String)
Sub ValidateXml(ByVal xmlFile As String, ByVal xsdFile As String) Implements IXmlValidator.ValidateXml
Try
Dim settings As Xml.XmlReaderSettings = New Xml.XmlReaderSettings()
settings.Schemas.Add("urn:MyTool", xsdFile)
settings.ValidationType = Xml.ValidationType.Schema
Dim reader As Xml.XmlReader = Xml.XmlReader.Create(xmlFile, settings)
Dim document As Xml.XmlDocument = New Xml.XmlDocument()
document.Load(reader)
Dim eventHandler As ValidationEventHandler = New ValidationEventHandler(AddressOf ValidationEventHandler)
document.Validate(eventHandler)
reader.Close()
reader = Nothing
document = Nothing
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Sub ValidateXml1(ByVal xmlFile As String, ByVal xsdFile As String) Implements IXmlValidator.ValidateXml1
Try
Dim xsdMarkup As XElement = XElement.Load(xsdFile)
Dim schemas As XmlSchemaSet = New XmlSchemaSet()
schemas.Add("urn:MyTool", xsdMarkup.CreateReader)
Dim document As XDocument = XDocument.Load(xmlFile)
document.Validate(schemas, AddressOf ValidationEventHandler)
document = Nothing
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Public ReadOnly Property GetErrorList() As List(Of String) Implements IXmlValidator.GetErrorList
Get
Return vErrLst
End Get
End Property
Private Sub ValidationEventHandler(ByVal sender As Object, ByVal e As ValidationEventArgs)
Select Case e.Severity
Case XmlSeverityType.Error
vErrLst.Add(String.Format("Error in line: {0} = {1}", e.Exception.LineNumber, e.Message))
Case XmlSeverityType.Warning
vErrLst.Add(String.Format("Warning in line: {0} = {1}", e.Exception.LineNumber, e.Message))
End Select
End Sub
End Class
Above code is called in WinForm this way:
Dim xv As IXmlValidator = New TXmlValidator()
xv.ValidateXml(Me.TxtXml.Text, Me.TxtXsd.Text)
Dim qry As List(Of String) = xv.GetErrorList()
Dim iErr As Integer = qry.Count()
Me.LstOfErrors.Items.Add(String.Format("Errors count: {0} - document is {1} valid!", iErr.ToString(), IIf(iErr > 0, "not", "")))
xv.ValidateXml1(Me.TxtXml.Text, Me.TxtXsd.Text)
qry = xv.GetErrorList()
iErr = qry.Count()
Me.LstOfErrors.Items.Add(String.Format("Errors count: {0} - document is {1} valid!", iErr.ToString(), IIf(iErr > 0, "not", "")))
xv = Nothing
Note: above code was written in hurry. Real code is a part of biggest project. I can't post it.
As you can see AddReqs must be one these values: "Y " or "N " only. In an xml file Addreqs field is empty!
|
|
|
|
|
You probably need toshow more of the code. Some of the XML and XSD.
|
|
|
|
|
|
using (XmlTextReader xmlTextReader = new XmlTextReader("FILE_NAME.xml"))
{
while (xmlTextReader.Read())
{
switch (xmlTextReader.NodeType)
{
}
}
}
vinuvasahanponniah
|
|
|
|
|
Thanks for your reply, but i'm not interesting different solution, because i've got it. I know how to process through the collection of xml nodes.
I'm wondering why XmlReader returns {none} instead of XmlReader object...
|
|
|
|
|
Hi,
I need to convert pdf file into tif file format with expected dpi resolution in Visual Basic 2008 programming.
please explain with example code.
thanks,
|
|
|
|