xrjf 163

I am very happy that you could resolve the issue. Thanks.

xrjf 163

There should be no problem by name. Could you upload an image of the Console listing the name (option 2.) ? Use the snipping tool for that purpose.

rproffitt commented: I agree but I've seen folk go down this rabbit hole and the name wasn't in the data. +15
xrjf 163

¿Are you entering the complete name? The select command is NOT case sensitive, but if you want to use the percent wildcard '%', the function would be then:

    Function Find_Device_By_Name(name As String) As Boolean
        Try
            ' See if the desired device shows up in the device manager. '
            Dim info As Management.ManagementObject
            Dim search As New System.Management.ManagementObjectSearcher(
                "SELECT * FROM Win32_PnPEntity WHERE Name LIKE '%" + name + "%'")
            For Each info In search.Get()
                Dim devname As String = CType(info("Name"), String)
                Dim ID As String = CType(info("DeviceID"), String)
                Console.WriteLine("Device ID is: " + ID.ToString)
                Console.WriteLine("       name=" + devname)
            Next
            Return True ' Device(s) Found '
        Catch ex As Exception

        End Try
        'We did not find the device we were looking for '
        Return False
    End Function
xrjf 163

Vendor ID (VID) and Product (ID) is not the same as serial number. Two equal devices from the same vendor will have the same VID & PID because are the same product from the same vendor, but different serial numbers.
I have made same changes to the code so you can find also a device by name:

Imports System.Management

Module Module1

    Dim vIDs() As String, iv As Int32 = 0
    Dim deviceID = "VID_0461&PID_4E22" ' Change to your's 
    Dim bDsp As Boolean = True
    Dim bAttached As Boolean = False
    Sub Main()
        Do
            Console.WriteLine("1. List All Devices")
            Console.WriteLine("2. List USB Devices")
            Console.WriteLine("3. Find out the device ID")
            Console.WriteLine("4. Find if Device " + deviceID + " is connected.")
            Console.WriteLine("5. Find device(s) by name.")
            Console.WriteLine("6. Exit")
            Select Case Console.ReadLine
                Case "1" : Detect_missing_VID_PID()
                Case "2" : Detect_missing_VID_PID("USB" + Chr(92))
                Case "3"
                    Console.Clear()
                    Console.WriteLine("Press 'Enter' key when the device is attached.")
                    Console.ReadLine()
                    bDsp = False
                    iv = 0
                    Detect_missing_VID_PID("USB" + Chr(92))
                    Console.WriteLine("Detach the device and press 'Enter' key.")
                    Console.ReadLine()
                    Detect_missing_VID_PID("USB" + Chr(92))
                    Console.WriteLine("Device ID is: " + deviceID)
                    Console.WriteLine("Attach again the device and press 'Enter' key.")
                    Console.ReadLine()
                    bAttached = Find_Device_By_ID(deviceID)
                    Console.WriteLine("Now on if you attach/remove it'll be detected. Press any key to exit.")
                    Do
                        Dim nowAttached As Boolean = Find_Device_By_ID(deviceID)
                        If nowAttached <> bAttached Then
                            bAttached = nowAttached
                            If bAttached Then
                                Console.WriteLine("Attached")
                            Else
                                Console.WriteLine("Removed")
                            End If
                        End If
                        System.Threading.Thread.Sleep(500)
                    Loop While Not Console.KeyAvailable
                    bDsp = True
                Case "4"
                    If Find_Device_By_ID(deviceID) Then
                        Console.WriteLine("Connected!")
                    End If
                Case "5"
                    Console.Write("Device's name is?: ")
                    Dim name ...
xrjf 163

I imagine you'll want to know if the mouse is attached or removed. Here is another version where this task is done (in option 3).

Imports System.Management

Module Module1

    Dim vIDs() As String, iv As Int32 = 0
    Dim VID_PID_device = "VID_0461&PID_4E22" ' Change to your's 
    Dim bDsp As Boolean = True
    Dim bAttached As Boolean = False
    Sub Main()
        Do
            Console.WriteLine("1. List All Devices")
            Console.WriteLine("2. List USB Devices")
            Console.WriteLine("3. Find out the VID and the PID of the mouse.")
            Console.WriteLine("4. Find if Device " + VID_PID_device + " is connected.")
            Console.WriteLine("5. Exit")
            Select Case Console.ReadLine
                Case "1" : ListDevices_VID_PID()
                Case "2" : ListDevices_VID_PID("USB" + Chr(92))
                Case "3"
                    Console.Clear()
                    Console.WriteLine("Press 'Enter' key when the mouse is attached.")
                    Console.ReadLine()
                    bDsp = False
                    iv = 0
                    ListDevices_VID_PID("USB" + Chr(92))
                    Console.WriteLine("Detach the mouse and press 'Enter' key.")
                    Console.ReadLine()
                    ListDevices_VID_PID("USB" + Chr(92))
                    Console.WriteLine("Mouse VID and PID is: " + VID_PID_device)
                    Console.WriteLine("Attach again the mouse and press 'Enter' key.")
                    Console.ReadLine()
                    bAttached = Find_Device_By_VID_PID(VID_PID_device)
                    Console.WriteLine("Now on if you attach/remove it'll be detected. Press any key to exit.")
                    Do
                        Dim nowAttached As Boolean = Find_Device_By_VID_PID(VID_PID_device)
                        If nowAttached <> bAttached Then
                            bAttached = nowAttached
                            If bAttached Then
                                Console.WriteLine("Attached")
                            Else
                                Console.WriteLine("Removed")
                            End If
                        End If
                        System.Threading.Thread.Sleep(500)
                    Loop While Not Console.KeyAvailable
                    bDsp = True
                Case "4"
                    If Find_Device_By_VID_PID(VID_PID_device) Then
                        Console.WriteLine("Connected!")
                    End If
                Case "5" : Exit Do
            End Select
        Loop
    End Sub
    Sub ListDevices_VID_PID(Optional sFilter As String = "")
        Try
            Dim bCompare As Boolean = IIf(iv = 0, False, True)
            Dim info As Management.ManagementObject
            Dim search As System.Management.ManagementObjectSearcher
            Dim Name ...
xrjf 163

If you want to list only USB devices, you may do:

    Function DetectDevice(DeviceName As String) As Boolean
        Try
            ' See if the desired device shows up in the device manager.'
            Dim info As Management.ManagementObject
            Dim search As System.Management.ManagementObjectSearcher
            Dim Name As String
            search = New System.Management.ManagementObjectSearcher("SELECT * From Win32_PnPEntity")
            For Each info In search.Get()
                ' Go through each device detected.'
                Name = CType(info("Caption"), String) ' Get the name of the device.'
                Dim ID As String = CType(info("DeviceID"), String)
                If InStr(info.Path.ToString, "USB\\") Then
                    Console.WriteLine(Name + " " + ID)
                    If InStr(Name, DeviceName, CompareMethod.Text) > 0 Then
                        Return True
                    End If
                End If
            Next
        Catch ex As Exception

        End Try
        'We did not find the device we were looking for'
        Return False
    End Function
xrjf 163

Click Here
You should add a reference to System.Management dll

    Function DetectDevice(DeviceName As String) As Boolean
        Try
            ' See if the desired device shows up in the device manager.'
            Dim info As Management.ManagementObject
            Dim search As System.Management.ManagementObjectSearcher
            Dim Name As String
            search = New System.Management.ManagementObjectSearcher("SELECT * From Win32_PnPEntity")
            For Each info In search.Get()
                ' Go through each device detected.'
                Name = CType(info("Caption"), String) ' Get the name of the device.'
                If InStr(Name, DeviceName, CompareMethod.Text) > 0 Then
                    Return True
                End If
            Next
        Catch ex As Exception

        End Try
        'We did not find the device we were looking for'
        Return False
    End Function
xrjf 163

Just split the fields inside each row:

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Try
            For Each row As String In File.ReadAllLines("Table.csv")
                ' split the fields from the row '
                Dim vFields() As String = Split(row, ";")
                If vFields(0).Contains(TextBox1.Text) Then ' vFields(0) = specificaion '
                    lblValue1.Text = vFields(1) ' vFields(1) is value 1 '
                    lblValue2.Text = vFields(2) ' vFields(2) is value 2
                End If
            Next
        Catch ex As Exception

        End Try
    End Sub

TableCSV.PNG

xrjf 163

I've made several improvents to the code, so here is another version.

xrjf 163

You may want to add a user control, with 4 or 6 textboxes depending on IPv4 or IPv6. For example:

Public Class IP_Textbox
    Const nBytes As Int32 = 4 ' IPv4 (change to =6 if IPv6)
    Dim vTextbox(nBytes - 1) As TextBox
    Dim vLabel(nBytes - 2) As Label
    Private Sub IP_Textbox_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Try
            Me.BackColor = Color.White
            Dim left As Int32 = 4
            For i As Int32 = 0 To nBytes - 1
                vTextbox(i) = New TextBox
                With vTextbox(i)
                    .Width = 25
                    .TextAlign = HorizontalAlignment.Center
                    .BorderStyle = BorderStyle.None
                    .BackColor = Color.White
                    .MaxLength = 3
                    .Location =
                        New Point(left, 3 + (Me.Height - vTextbox(i).Height) / 2)
                    AddHandler .Validating, AddressOf vTextChanged
                    left += 25
                End With
                Me.Controls.Add(vTextbox(i))
                If i < nBytes - 1 Then
                    vLabel(i) = New Label
                    With vLabel(i)
                        .AutoSize = True
                        .Text = ","
                        .BorderStyle = BorderStyle.None
                        .BackColor = Color.White
                        .Location = New Point(left, 7)
                        left += 10
                    End With
                    Me.Controls.Add(vLabel(i))
                End If
            Next
            Me.Width = left + 6
            Me.Height += 2
        Catch ex As Exception

        End Try
    End Sub
    Public ReadOnly Property IP As String()
        Get
            Dim vText(vTextbox.Length - 1) As String
            Try
                For i As Int32 = 0 To vText.Length - 1
                    vText(i) = vTextbox(i).Text
                Next
            Catch ex As Exception

            End Try
            Return vText
        End Get
    End Property
    Private Sub vTextChanged(sender As Object, e As System.ComponentModel.CancelEventArgs)
        Try
            Dim tb As TextBox = CType(sender, TextBox)
            tb.Text = Trim(tb.Text)
            If Len(tb.Text) = 0 Then tb.Text = "0"
            Dim ip As Int32
            If Int32.TryParse(tb.Text, ip) AndAlso ...
xrjf 163

Coding like the following you get the attached image:

Public Class Form1
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        ListView1.View = View.Details
        For i As Int32 = 0 To 3
            Dim ch As ColumnHeader = ListView1.Columns.Add("Column " + (i + 1).ToString)
            ch.Width = 100
        Next

        With ListView1
            Dim vDates() As String = {"2019/01/01", "2019/01/01", "2019/01/01", "2019/01/02", "2019/01/02"}
            Dim lastID As Int32 = -1
            For id = 1 To 5
                Dim lastD As String = ""
                For Each d In vDates
                    Dim vFields() As String = {
                    " field A",
                    " field B"
                        }
                    Dim li As ListViewItem
                    If id <> lastID Then
                        li = .Items.Add(id.ToString)
                        lastID = id
                    Else
                        li = .Items.Add("")
                    End If
                    If d <> lastD Then
                        li.SubItems.Add(d)
                        lastD = d
                    Else
                        li.SubItems.Add("")
                    End If
                    For iRow As Int32 = 0 To vFields.Length - 1
                        Dim str As String = "ID:" + id.ToString + " date:" + d
                        li.SubItems.Add(str + vFields(iRow))
                    Next
                Next
            Next
        End With
    End Sub
End Class

ListView.PNG

xrjf 163

Why not launch a modal pop-up from client side or server side using Ajax Toolkit? See Here

xrjf 163

Looks like there is a comparison between a numeric value (PROPID) and a string ('%" & Textbox2.Text & "%' ). The solution is to convert both to same type by means of CAST or CONVERT:
Syntax for CAST:
CAST ( expression AS data_type [ (length ) ])
or
Syntax for CONVERT:
CONVERT ( data_type [ ( length ) ] , expression [ , style ] )

xrjf 163

Assuming you correct the XML file and you know the name of the fields, you could do something like the following:

Imports System.IO

Public Class XMLreader
    Private Sub Populate_Click(sender As Object, e As EventArgs) Handles Populate.Click
        extractFields()
    End Sub
    Sub extractFields()
        Try
            Dim svFields() As String = {"code", "codeSystemName"}
            Dim vFieldType() As Type = {GetType(Int32), GetType(String)}
            Dim dt As New DataTable
            For i As Int32 = 0 To svFields.Length - 1
                dt.Columns.Add(New DataColumn(svFields(i), vFieldType(i)))
            Next
            Dim _assembly As System.Reflection.Assembly = System.Reflection.Assembly.GetExecutingAssembly
            Dim sr As Stream = _assembly.GetManifestResourceStream("XMLreader.XMLreader.xml")
            Using xtr As System.Xml.XmlReader = System.Xml.XmlReader.Create(sr)
                Do While xtr.Read
                    If xtr.IsStartElement Then
                        If xtr.HasAttributes Then
                            Dim nFields As Int32 = 0
                            Dim vRow(svFields.Length - 1)
                            While xtr.MoveToNextAttribute
                                Dim pos As Int32 = Array.IndexOf(svFields, xtr.Name)
                                If pos > -1 Then
                                    vRow(pos) = xtr.Value
                                    nFields += 1
                                    If nFields = svFields.Length Then
                                        Dim dr As DataRow = dt.NewRow
                                        dr.ItemArray = vRow
                                        dt.Rows.Add(dr)
                                    End If
                                End If
                            End While
                        End If
                    End If
                Loop
            End Using
            With DataGridView1
                .DataSource = dt
                .AutoResizeColumns(DataGridViewAutoSizeColumnsMode.DisplayedCells)
            End With
        Catch ex As Exception

        End Try
    End Sub
End Class
xrjf 163

What do you mean by a "slow" machine? Anyway verify the path of the images. If the images are not found there will not be no message unless you add a line after line number 95, for example `If i = -1 AndAlso not IO.File.Exists(path) Then msgbox("file not found: "+path)

xrjf 163

You just have to proceed similarly as for the "+" and "-" operators. Now, the code is:

import java.util.ArrayList;
import java.util.Scanner;
import static java.lang.Integer.*;
import static java.lang.System.*;

public class ExpressionSolver
{
    int answer;
    String expString;
    ArrayList<String> exp;
    public ExpressionSolver(String s)
    {
        setExpression(s);
    }

    public void setExpression(String s)
    {
        expString = s;
        exp = new ArrayList<String>();

        for(String temp: s.split(" "))
        {
         exp.add(temp);
        }
    }

    public void solveExpression()
    { 
       int index1, index2, num1, num2;        

      while(exp.contains("*") || exp.contains("/"))
      {
           index1 = exp.indexOf("*");
           index2 = 0;
           if(index1 <= 0)
           {
             index1 = exp.indexOf("/");
             index2 = 1;
           }
         num1 = Integer.parseInt(exp.get(index1-1));
         num2 = Integer.parseInt(exp.get(index1+1));
        if(index2 == 0)
         {
            answer = num1 * num2;
         }
         else
         {
            answer = num1 / num2;
         }
         exp.remove(index1 - 1);
         exp.remove(index1 - 1);
         exp.set(index1 - 1, Integer.toString(answer));
      }
      while(exp.contains("+") || exp.contains("-"))
      {
           index1 = exp.indexOf("+");
        index2 = 0;
           if(index1 <= 0)
           {
             index1 = exp.indexOf("-");
          index2 = 1;
           }
         num1 = Integer.parseInt(exp.get(index1-1));
         num2 = Integer.parseInt(exp.get(index1+1));
        if(index2 == 0)
         {
            answer = num1 + num2;
         }
         else
         {
            answer = num1 - num2;
         }

         exp.remove(index1 - 1);
         exp.remove(index1 - 1);
         exp.set(index1 - 1, Integer.toString(answer));

      }
}

  public String toString()   
  {
   return expString + " = " + answer;
  }
}
xrjf 163

I've only take a look to addition and substraction and made some modifications. I hope you understand it and leave up to you the other operators.

import java.util.ArrayList;
import java.util.Scanner;
import static java.lang.Integer.*;
import static java.lang.System.*;

public class ExpressionSolver
{
    int answer;
    String expString;
    ArrayList<String> exp;
    public ExpressionSolver(String s)
    {
        setExpression(s);
    }

    public void setExpression(String s)
    {
        expString = s;
        exp = new ArrayList<String>();

        for(String temp: s.split(" "))
        {
         exp.add(temp);
        }
    }

    public void solveExpression()
    { 
       int index1, index2, num1, num2;        

       while(exp.contains("*") || exp.contains("/"))
       {
         index1 = exp.indexOf("*");
         index2 = exp.indexOf("/");

         if(index1 <= 0)
         {
          index1 = 100;
         }
         if (index2 <= 0)
         {
          index2 = 100;
         }

          if(index1 < index2)
         {   
          num1 = Integer.parseInt(exp.get(index1-1));
          num2 = Integer.parseInt(exp.get(index1+1));
          answer = num1 * num2;

          exp.remove(index1 - 1);
          exp.remove(index1 - 1);
          exp.set(index1 - 1, Integer.toString(answer));
         }
         else if(index2 < index1)
         {
           num1 = Integer.parseInt(exp.get(index2 - 1));
           num2 = Integer.parseInt(exp.get(index2 + 1));
           answer = num1 / num2;

           exp.remove(index2 -1);
           exp.remove(index2 - 1);
           exp.set(index1 -1 ,Integer.toString(answer));
          }
      }
      while(exp.contains("+") || exp.contains("-"))
      {
           index1 = exp.indexOf("+");
        index2 = 0;
           if(index1 <= 0)
           {
             index1 = exp.indexOf("-");
          index2 = 1;
           }
         num1 = Integer.parseInt(exp.get(index1-1));
         num2 = Integer.parseInt(exp.get(index1+1));
        if(index2 == 0)
         {
            answer = num1 + num2;
         }
         else
         {
            answer = num1 - num2;
         }

         exp.remove(index1 - 1);
         exp.remove(index1 - 1);
         exp.set(index1 - 1, Integer.toString(answer));

      }
}

  public String toString()   
  {
   return expString + " = " + answer;
  }
}
xrjf 163

Of course if you're not coding in VBasic like me, most probably you'll have to escape the slash /. So the pattern becomes collections\/(?!\/|shirts|tea|[\w]+\/products)

xrjf 163

Assuming products (if present) is after the second / character like in
collections/shirts/products/tee-shirt,
collections(/(?!/|shirts|tea|[\w]+/products)) seems to work.

EvolutionFallen commented: Perfect! Just what I was looking for. +9
xrjf 163

Type in Google:

w3schools customers.php
The first link appeared to have:

{ "records":[ {"Name":"Alfreds Futterkiste","City":"Berlin","Country":"Germany"}, {"Name":"Ana Trujillo Emparedados y helados","City":"México D.F.","Country":"Mexico"}, {"Name":"Antonio Moreno Taquería","City":"México D.F.","Country":"Mexico"}, {"Name":"Around the Horn","City":"London","Country":"UK"}, {"Name":"B's Beverages","City":"London","Country":"UK"}, {"Name":"Berglunds snabbköp","City":"Luleå","Country":"Sweden"}, {"Name":"Blauer See Delikatessen","City":"Mannheim","Country":"Germany"}, {"Name":"Blondel père et fils","City":"Strasbourg","Country":"France"}, {"Name":"Bólido Comidas preparadas","City":"Madrid","Country":"Spain"}, {"Name":"Bon app'","City":"Marseille","Country":"France"}, {"Name":"Bottom-Dollar Marketse","City":"Tsawassen","Country":"Canada"}, {"Name":"Cactus Comidas para llevar","City":"Buenos Aires","Country":"Argentina"}, {"Name":"Centro comercial Moctezuma","City":"México D.F.","Country":"Mexico"}, {"Name":"Chop-suey Chinese","City":"Bern","Country":"Switzerland"}, {"Name":"Comércio Mineiro","City":"São Paulo","Country":"Brazil"} ] }
xrjf 163

Your language uses "," as decimal separator and "." as thousand separator and that is why instead of retrieving 1/4 (=0.25), CDbl is getting 25. Use double.parse instead, setting the NumberFormat you need:

        Dim ni As Globalization.NumberFormatInfo = Globalization.CultureInfo.CurrentCulture.NumberFormat.Clone
        ni.NumberDecimalSeparator = "."
        tara = Double.Parse(lblindicador2.Text, ni)
        PB = Double.Parse(lblindicador.Text, ni)
xrjf 163

What an old thread, isn't it?

xrjf 163

In this other way the code seems to work:

x = [16.7, 16.5, 16.1, 15, 13.5,14.2, 14.9, 13.7] # an example
D = [0, 1, 4, 7, 16, 31, 64, 127] # example
n_H = 0.9
Sec_nucli = 0

## I defined the function like this:
def Fragmentation(D,x):
    s_nucli = n_H * D * x
    return s_nucli

for xi in x: 
    for Dj in D:
      print(xi, Dj)
      Sec_nucli += Fragmentation(xi,Dj)
      print(Sec_nucli)
xrjf 163
            Dim vplaats() As String = Split(Replace(TextBox1.Text, "'", "''"), " ")
            vplaats(0) = StrConv(vplaats(0), VbStrConv.ProperCase)
            vplaats(vplaats.Length - 1) = StrConv(vplaats(vplaats.Length - 1), VbStrConv.ProperCase)
            Dim platts As String = Join(vplaats, " ")
xrjf 163

Then call by means of XMLHttpRequest another php that grabs the phone number and any other data to record what is necessary.

<script>

      function checkmax(element) {

          if(element.value.length == 9){

             var xhr = new XMLHttpRequest();
             xhr.open('POST', '/server/getPhone.php', true);
             //Send the header 
             xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

             xhr.onreadystatechange = function() {//Call a function when the state changes.
             if(xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200) {
             // Request finished. Do processing here.
             }
             xhr.send("phone="+urlencode(element.value)+"&foo=bar");

          }
      }

</script>
xrjf 163

I agree in that the only way I can see is to submit the form back to the server. Something like:

<!DOCTYPE html>
<html>
<body>
<script>
  function chkLen() {
  if(document.getElementById("dCell").value.length =10)
    document.getElementById("myForm").submit(); 
}
</script>
<form name="myForm" onsubmit="myPhp.php">
<input id="dCell" type="text" onChange="chkLen();" value="<?php echo $_SESSION['mySessionIDHere'];?>" />
</form>
</body>
</html>
xrjf 163

The xml file should look like the following:

<?xml version="1.0" encoding="UTF-8"?>
<Programme Path="1">
  <Feld Icon="Folder.ico" Path="2">Feld 1<VisualStudio Path="C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe" Icon="VS.png">Visual Studio</VisualStudio>
    <Excel Path="C:\Program Files\Microsoft Office 15\root\office15\EXCEL.EXE" Icon="Excel.png">Excel</Excel>
  </Feld>
  <Home Icon="Folder.ico" Path="3">Home Place<Notepad Path="C:\Program Files\Notepad++\notepad++.exe" Icon="notepad.png">Notepad ++</Notepad>
    <JaTool Path="C:\Program Files (x86)\Tool7\javaw.exe" Argumente="-splash:splash.png -cp ./cl/cl.jar; -Dawt.useSystemAAFontSettings=on" Icon="JaTool.ico" RunPath="C:\Program Files (x86)\Tool7\bin\..">JaTool</JaTool>
  </Home>
</Programme>
xrjf 163

The easiest way to store the attributes is in a new class, in order to extend the NodeTree class. So when reading the xml attributes, store them in this -let's call it- 'extendNode' class. Then, in the TreeView node all it's needed is to set the node's 'Tag' property to the 'extendNode' instance where the attributes are.

Imports System.Xml
Imports System.IO
Imports System.Text

Public Class treeViewLoadXml
    Dim imgLst As New ImageList
    Dim vImgPath(-1) As String, iv As Int32 = 0
    Private Sub treeViewLoadXml_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        Load_XML()
    End Sub
    Public Sub Load_XML()
        Try
            ' Get Xml's file stream.

            imgLst.ImageSize = New Drawing.Size(30, 27)

            Dim vPath() As String = Split(Application.ExecutablePath, "\")
            vPath(vPath.Length - 1) = "XMLFile2.xml"
            Dim filepath As String = Join(vPath, "\")
            Dim _rstream As New FileStream(filepath, FileMode.Open)

            ' Load Xml document.
            '
            Dim dom As New XmlDocument()
            dom.Load(_rstream)
            _rstream.Close()

            ' Initialize treeView control.
            '
            TreeView1.BeginUpdate()
            TreeView1.Nodes.Clear()
            TreeView1.Nodes.Add(New TreeNode(dom.DocumentElement.Name))

            ' Populate the treeView with the dom nodes.
            '
            AddNode(dom.DocumentElement, TreeView1.Nodes(0))
            If iv Then
                For i = 0 To iv - 1
                    imgLst.Images.Add(Image.FromFile(vImgPath(i)))
                Next
                TreeView1.ImageList = imgLst
            End If
            TreeView1.EndUpdate()
            TreeView1.ExpandAll()
        Catch xmlEx As XmlException
            MessageBox.Show(xmlEx.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub
    Private Sub AddNode(ByVal inXmlNode As XmlNode, ByVal inTreeNode As TreeNode)
        Dim i As Integer
        If inXmlNode.HasChildNodes Then
            Dim nodeList As XmlNodeList
            nodeList = inXmlNode.ChildNodes
            i = 0
            While i <= nodeList.Count - 1
                Dim xNode As XmlNode = inXmlNode.ChildNodes(i)
                Dim imgIndex As Int32 = -1

                Dim eN As New extendNode ' eN ...
xrjf 163

By custom arguments I mean custom attributes. In a xml file a node may have as many attributes as you wish, but Treenode control has it's own and fixed properties. In case you need to add extra attributes to Treenode you may create a custom class derived from Treenode.

xrjf 163

Think that TreeNode can't hold custom arguments. Change the xml so the path is complete:

<?xml version="1.0" encoding="UTF-8"?>

<Programme Path="1">
  <Feld Icon="Folder.ico" Path="2">Feld 1<VisualStudio Path="C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe" Icon="VS.png">Visual Studio</VisualStudio>

    <Excel Path="C:\Program Files\Microsoft Office 15\root\office15\EXCEL.EXE" Icon="Excel.png">Excel</Excel>
  </Feld>
     If File.Exists(Path) Then
  <Home Icon="Folder.ico" Path="3">Home Place<Notepad Path="C:\Program Files\Notepad++\notepad++.exe" Icon="notepad.png">Notepad ++</Notepad>
    <JaTool Path="C:\Program Files (x86)\Tool7\javaw.exe -splash:splash.png -cp ./cl/cl.jar; -Dawt.useSystemAAFontSettings=on" Icon="JaTool.ico" RunPath="C:\Program Files (x86)\Tool7\bin\..">JaTool</JaTool>

  </Home>
</Programme>

and then change the following:

     If File.Exists(Path) Then
        Process.Start(Path)
       'Dim MyProcess As New Process()
       'MyProcess.StartInfo.FileName = Path
       'MyProcess.StartInfo.Arguments = Argumente '(optional)
       Dim pos As Int32 = InStr(Path, " -")
      'MyProcess.Start()
    End If

by:

      Dim pos As Int32 = InStr(Path, " -")
      Dim Argumente As String = ""
      If pos Then
          Argumente = Mid(Path, pos)
          Path = Mid(Path, 1, pos - 1)
      End If
      If File.Exists(Path) Then
          Process.Start(Path, Argumente)
      End If