Click here to Skip to main content
16,007,610 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: file empt Pin
MatrixCoder25-Mar-07 8:38
MatrixCoder25-Mar-07 8:38 
AnswerRe: file empt Pin
TwoFaced25-Mar-07 8:41
TwoFaced25-Mar-07 8:41 
QuestionFiltering data in Crystal Report Pin
Sheryl P25-Mar-07 4:16
Sheryl P25-Mar-07 4:16 
QuestionRemove top bar but keep title Pin
harveyhanson25-Mar-07 3:45
harveyhanson25-Mar-07 3:45 
AnswerRe: Remove top bar but keep title Pin
Christian Graus25-Mar-07 3:47
protectorChristian Graus25-Mar-07 3:47 
GeneralRe: Remove top bar but keep title Pin
harveyhanson25-Mar-07 6:19
harveyhanson25-Mar-07 6:19 
AnswerRe: Remove top bar but keep title Pin
MatrixCoder25-Mar-07 8:41
MatrixCoder25-Mar-07 8:41 
QuestionI need some push to solve the problem in updating XML file Pin
JUNEYT25-Mar-07 3:32
JUNEYT25-Mar-07 3:32 
Hi!

The function below reads some values from an xml file perfectly. However when I try to save some values of submitted keys into xml file, it doesn't find the values in xml file and trying to create them. What is causing the problem.

'This procedure works fine
Private Function GetCnfgParameter(ByVal MyKey As String) As String

        Dim DocXml As New XmlDocument
        Dim NodeXml As XmlNode = Nothing

        DocXml.Load(Path.Combine(Application.StartupPath, "app.xml"))

        NodeXml = DocXml.DocumentElement.SelectSingleNode("//AppDefaultValues/add[@key=""" & MyKey & """]")
        If TypeName(NodeXml.Attributes.GetNamedItem("value")) <> "Nothing" Then
            Return NodeXml.Attributes.GetNamedItem("value").Value
        Else
            Dim Message As String = String.Empty
            Message += "GetCnfgParameter:: app.con dosyasında tahrifat tespit edildi." & vbCrLf & vbCrLf
            Message += "Program kendi atamalarını kullanacaktır."

            MsgBox(Message, MsgBoxStyle.Critical)
            Return Nothing
        End If

    End Function


But this procedure is not finding the same values in xml file even checking the node is as same as the above statements inside the procedure What is causing the problem? Thanks.

Private Function SaveConfigParameter(ByVal MyKey As String, ByVal MyValue As String) As Boolean

    Dim DocXml As New XmlDocument
    Dim NodeXml As XmlNode
    Dim RootXml As XmlNode
    Dim KeyXml As XmlNode
    Dim ValueXml As XmlNode

    SaveConfigParameter = False
    DocXml.Load(Path.Combine(Application.StartupPath, "app.xml"))
    NodeXml = DocXml.DocumentElement.SelectSingleNode("//AppDefaultValues/add[key=""" & MyKey & """]")

    If NodeXml Is Nothing Then
        ' The node does not exist, let's create it but nodes exist actually

        NodeXml = DocXml.CreateNode(XmlNodeType.Element, "add", "")

        ' Adding the Key attribute to the node, keep in mind, Xml tokens are case sensitive
        ' We should use 'key' instead of 'Key'

        KeyXml = DocXml.CreateNode(XmlNodeType.Attribute, "key", "")
        KeyXml.Value = MyKey
        NodeXml.Attributes.SetNamedItem(KeyXml)

        ' Adding the key value, once again, remember that Xml tokens are case sensitive

        ValueXml = DocXml.CreateNode(XmlNodeType.Attribute, "value", "")
        ValueXml.Value = MyValue
        NodeXml.Attributes.SetNamedItem(ValueXml)

        ' Add the new node to the root

        RootXml = DocXml.DocumentElement.SelectSingleNode("//AppDefaultValues")
        If Not RootXml Is Nothing Then
            RootXml.AppendChild(NodeXml)
        Else
            SaveConfigParameter = False
        End If
    Else
        '
        ' The node exist, save the new value
        '
        NodeXml.Attributes.GetNamedItem("value").Value = MyValue
        SaveConfigParameter = True
    End If
    DocXml.Save(Path.Combine(Application.StartupPath, "app.xml"))
    DocXml = Nothing

End Function



What a curious mind needs to discover knowledge is noting else than a pin-hole.


AnswerRe: Problems with uploading files to HTTP/FTP Pin
kubben25-Mar-07 3:07
kubben25-Mar-07 3:07 
GeneralRe: Problems with uploading files to HTTP/FTP Pin
Brad^25-Mar-07 9:10
Brad^25-Mar-07 9:10 
GeneralRe: Problems with uploading files to HTTP/FTP Pin
kubben25-Mar-07 10:08
kubben25-Mar-07 10:08 
GeneralRe: Problems with uploading files to HTTP/FTP Pin
Brad^25-Mar-07 10:15
Brad^25-Mar-07 10:15 
GeneralRe: Problems with uploading files to HTTP/FTP Pin
Brad^25-Mar-07 10:49
Brad^25-Mar-07 10:49 
Questionmdilist property in MDI Forms Pin
Krishnan2325-Mar-07 0:24
Krishnan2325-Mar-07 0:24 
QuestionPlease Help Me. It is Very Urgent . Pin
harshpatil25-Mar-07 0:18
harshpatil25-Mar-07 0:18 
AnswerRe: Please Help Me. It is Very Urgent . Pin
Bassam Saoud25-Mar-07 1:13
Bassam Saoud25-Mar-07 1:13 
AnswerRe: Please Help Me. It is Very Urgent . Pin
Christian Graus25-Mar-07 3:19
protectorChristian Graus25-Mar-07 3:19 
GeneralRe: Please Help Me. It is Very Urgent . Pin
Kevin McFarlane25-Mar-07 5:08
Kevin McFarlane25-Mar-07 5:08 
QuestionHow can i delete files that are in use? Pin
A*****24-Mar-07 21:43
A*****24-Mar-07 21:43 
AnswerRe: How can i delete files that are in use? Pin
kubben25-Mar-07 2:15
kubben25-Mar-07 2:15 
QuestionButtons Pin
Viper82524-Mar-07 20:16
Viper82524-Mar-07 20:16 
AnswerRe: Buttons Pin
Christian Graus25-Mar-07 3:20
protectorChristian Graus25-Mar-07 3:20 
QuestionDesigner is showing a gray box but I can't figure out why. Please help. Pin
howardjr24-Mar-07 19:14
howardjr24-Mar-07 19:14 
QuestionMinimise a form Pin
Anybloodyid24-Mar-07 11:50
Anybloodyid24-Mar-07 11:50 
AnswerRe: Minimise a form [modified] Pin
green2go24-Mar-07 12:13
green2go24-Mar-07 12:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.