Page 2 of 2 FirstFirst 12
Results 41 to 44 of 44

Thread: [RESOLVED] vb.net improve programs

  1. #41

    Thread Starter
    Member
    Join Date
    Jul 2020
    Posts
    51

    Re: vb.net improve programs

    ok i guess this is too much difficult for me..
    stations it's correctly filled but combobox1 is empty.
    i keep on matrix.
    it takes longer,very hard to inquiry but it works
    many thanks to all of you

  2. #42
    PowerPoster ChrisE's Avatar
    Join Date
    Jun 2017
    Location
    Frankfurt
    Posts
    3,130

    Re: vb.net improve programs

    you can create a Access .mdb and Access doesn't have to be Installed
    on your Company PC

    Code:
     Private Sub Button4_Click(sender As System.Object, e As System.EventArgs) Handles Button4.Click
            'Add the COM Reference, "Microsoft ADO Ext. 6.0 for DLL and Security"
            ' create the empty DB file
            Dim cat As New ADOX.Catalog()
            cat.Create("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Berichte\Backup.mdb")
            cat = Nothing
        End Sub
    as easy as that
    to hunt a species to extinction is not logical !
    since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.

  3. #43

    Thread Starter
    Member
    Join Date
    Jul 2020
    Posts
    51

    Re: vb.net improve programs

    Quote Originally Posted by jmcilhinney View Post
    It's not going to be a SQL query because you're not querying a database. Let's say that you have a DataTable with the names of stations in Partenza and Arrivo columns and you want to list distinct values in alphabetical order. One option is to use a LINQ query:
    vb.net Code:
    1. Dim partenzaStations = table.AsEnumerable().Select(Function(row) row.Field(Of String)("Partenza"))
    2. Dim arrivoStations = table.AsEnumerable().Select(Function(row) row.Field(Of String)("Arrivo"))
    3. Dim stations = partenzaStations.Concat(arrivoStations).Distinct().OrderBy(Function(s) s).ToArray()
    4.  
    5. stationComboBox.DataSource = stations
    it works only if i don't order the list,otherwise the combobox it wont' be loaded !!
    i guess it's due the first value is nothing.
    but the where condition can not be applyied in the query.so strange
    Last edited by eurostar_italia; Jul 23rd, 2020 at 10:19 AM.

  4. #44

    Thread Starter
    Member
    Join Date
    Jul 2020
    Posts
    51

    Re: vb.net improve programs

    at the end i solved in this way :
    Code:
    Dim partenzaStations = From n In treno1.AsEnumerable()
    				   Where n.Field(Of String)("Partenza") IsNot Nothing
    				   Select n.Field(Of String)("Partenza")
    
    				   Dim arrivoStations = From n In treno1.AsEnumerable()
    				   Where n.Field(Of String)("Arrivo") IsNot Nothing
                 			 Select n.Field(Of String)("Arrivo")
    
    				Dim stations = partenzaStations.Concat(arrivoStations).Distinct().OrderBy(Function(s) s).ToArray()
    
    			       ComboBox1.DataSource = stations.ToArray
    				ComboBox1.SelectedIndex = -1
    maybe it will help somebody else

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width