xrjf 230 Posting Whiz

Just a quick update for anyone interested:

I have revisited and significantly improved the code, aiming for a more professional structure and better performance.
The updated version avoids freezing the UI during long operations and follows more robust programming practices.

If you’d like to see DiDi in action, there is also a video demonstration available — you can find it by searching for "xrjunque downloads" online.

xrjf 230 Posting Whiz

I've just made an update because some records weren't being added properly. The issue was that the form didn't take into account that the register field (in the call to DiDi) is passed by reference.

xrjf 230 Posting Whiz

"Just to clarify a previous mistake: the efficiency should be K × N × log₂(N), not K × log₂(N) as I initially wrote."

xrjf 230 Posting Whiz

As an illustration, consider the theoretical lower bound for comparison-based sorting, as stated by Donald Knuth in The Art of Computer Programming: K × log₂(N). I developed a simple method that matches this limit. For example, to sort the list {2, 5, 7, 1, 4, 3, 8, 6}:

Sort pairs:
(2, 5) → [1]
(1, 7) → [2]
(3, 4) → [3]
(6, 8) → [4]

Merge into groups of four:
(2, 5) + (1, 7) → max 3 comparisons
(3, 4) + (6, 8) → max 3 comparisons
→ Total so far: 10 comparisons

Merge into a single group of eight:
(1, 2, 5, 7) + (3, 4, 6, 8) → max 7 comparisons
→ Total: 17 comparisons

Extending this to 16 elements would require at most: 2 × 17 + 15 = 49 comparisons

However, DiDi is not just about matching the theoretical lower bound. It takes a fundamentally different approach: its performance is proportional to K × (maximum key length), independent of the number of elements. This opens new perspectives for data indexing and retrieval, beyond traditional comparison-based sorting.

xrjf 230 Posting Whiz

For example, as Donald Knuth points out in The Art of Computer Programming, the theoretical lower bound for comparison-based sorting algorithms is K × log₂(N). I developed a very simple method that matches this performance. However, DiDi goes far beyond: its performance is proportional to K × (maximum key length), regardless of the number of elements.

xrjf 230 Posting Whiz

About DiDi

DiDi (Differential Directory) was originally developed as part of my thesis project in the early 1990s. The name bears no relation to the more recent Chinese ride-sharing company. At the time, DiDi was a novel approach within its academic context, but a change in legislation unfortunately led to the closure of the school and the discontinuation of its degrees.

Despite that setback, I have always believed in the value of the project. Now, decades later, I feel it is the right time to share it publicly. This release is both a technical revival and a tribute to its original vision.

rproffitt commented: Was it Tr-mp University? +17
xrjf 230 Posting Whiz

Features:

  • Retrieves the differentiating bit of a key with respect to the previous one and stores only this position in the index.
  • With at most one single disk read, assuming the index is in memory, it determines whether the key exists or not.
  • The index is always sorted and therefore requires no reorganization.
  • Performance is proportional to the length of the keys, not to the size of the index.
  • Insertions require updating at most two or three nodes.

The Differential Directory (DiDi) stores only the difference between each key and the
previous one (already sorted), rather than storing full keys in each node.
Much like when writing a list by hand and using quotation marks (“) to indicate repetition
from the line above —for example:
John Miles
“ Smith
DiDi applies a similar concept, but instead of letters, it identifies the first differing bit
between keys. It stores this position in a node, which also contains references to the left and
right nodes (if they exist), and to the disk record where the full key and its data are stored.
For instance, if the first key inserted is "John Smith", the index is initially empty. The first
differing character (compared to “nothing”) is J at position 1, so the index becomes 1J →
record 1.
If we then insert "John Miles", we read 1J, confirm it matches at position 1, and read record

  1. The index is updated to:
    1J → record 1, right → record 2, …
xrjf 230 Posting Whiz

I am happy that you resolved the issue. Regards.

xrjf 230 Posting Whiz

Try and verify there are no nulls,

rpt.SetDataSource(ds)
rpt.Subreports("YourSubreport.rpt").SetDataSource(ds_detspk)

Also, there are some answers from some people that had the same problem [Here].(https://stackoverflow.com/questions/7525467/crystal-report-object-reference-not-set-to-an-instance-of-an-object)

xrjf 230 Posting Whiz

Of course, 'MySubReport.rpt' in rpt.Subreports("MySubReport.rpt").SetDataSource(ds_detspk.Tables(0)) should be replaced by the name you have given to your subreport.

xrjf 230 Posting Whiz

How many rows are there in ds.Table(0)? What are the fields in each row?

xrjf 230 Posting Whiz

I ment:

  rpt.SetDataSource(ds.Tables(0))
  rpt.Subreports("YourSubreport.rpt").SetDataSource(ds_detspk.Tables(0))
xrjf 230 Posting Whiz

Try:

rpt.SetDataSource(ds.Tables(0))
rpt.Subreports("YourSubreport.rpt").SetDataSource(ds.Tables(1))
xrjf 230 Posting Whiz

Lets see if this link does for you Click Here

xrjf 230 Posting Whiz

There is an example Here

xrjf 230 Posting Whiz

A better aproach would be:

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        Try
            Dim file As System.IO.StreamWriter
            Dim path As String = Application.StartupPath + "\test.txt"
            file = My.Computer.FileSystem.OpenTextFileWriter(path, False)
            For i As Integer = 0 To ComboBox3.Items.Count - 1
                ComboBox2.SelectedIndex = i
                Dim d As DateTime = DateTime.Now
                Dim parsedate As DateTime = ComboBox2.Items(i).ToString
                Dim d2 As DateTime = DateTime.ParseExact(parsedate, "dd/MM/yyyy HH:mm:ss", System.Globalization.CultureInfo.CurrentCulture)
                Dim ts As New TimeSpan((d - d2).Ticks)
                Dim dysdiff As Integer = ts.TotalDays
                Dim cbNum As Integer = 365 - dysdiff
                ComboBox3.Items(i) = cbNum.ToString
                Dim lstname As String
                lstname = ListBox1.Items(i).ToString()
                If cbNum <= 10 AndAlso cbNum >= 1 Then
                    file.WriteLine("test" + lstname + " have " + cbNum.ToString + " days left before will get delete")
                End If
            Next
            file.Close()
        Catch ex As Exception

        End Try
    End Sub
xrjf 230 Posting Whiz

Once a form has saved the text to a file, another form can read the data.

xrjf 230 Posting Whiz

For example, to write a text file just do:

    Sub WriteFile()
        Dim file As System.IO.StreamWriter
        file = My.Computer.FileSystem.OpenTextFileWriter("c:\test.txt", True)
        file.WriteLine("Here is the first string.")
        file.Close()
    End Sub

So, writing to a text file in Button5_Click could be:

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        Try
            Dim file As System.IO.StreamWriter
            file = My.Computer.FileSystem.OpenTextFileWriter("c:\test.txt", True)
            For i As Integer = 0 To ComboBox3.Items.Count - 1
                ComboBox2.SelectedIndex = i
                Dim d As DateTime = DateTime.Now
                Dim parsedate As DateTime = ComboBox2.Items(i).ToString
                Dim d2 As DateTime = DateTime.ParseExact(parsedate, "dd/MM/yyyy HH:mm:ss", System.Globalization.CultureInfo.CurrentCulture)
                Dim ts As New TimeSpan((d - d2).Ticks)
                Dim dysdiff As Integer = ts.TotalDays
                Dim cbNum As Integer = 365 - dysdiff
                ComboBox3.Items(i) = cbNum.ToString
                Dim lstname As String
                lstname = ListBox1.Items(i).ToString()
                If cbNum <= 10 AndAlso cbNum >= 1 Then
                    file.WriteLine("test", lstname & " have " & cbNum & " days left before will get delete", ToolTipIcon.None)
                End If
            Next
            file.Close()
        Catch ex As Exception

        End Try
        Exit Sub
    End Sub
xrjf 230 Posting Whiz

One way to share data between, for example, two forms can be writing and reading a file in disk. Here is a tutorial if needed.

rproffitt commented: Next thing you know we'll talk about SQL, etc. Good direction. +16
xrjf 230 Posting Whiz

The default device is DeviceNumber = -1.

xrjf 230 Posting Whiz

Remember to dispose the audio objects, otherwise there could be leaks of memory.
Also, could you mark as solved if you think so? Many thanks.

xrjf 230 Posting Whiz

Perhaps, you may try my guess of what you want:

    Const maxVal As Integer = 30
    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        Try
            Dim value As Integer = maxVal
            If Not IsNumeric(Label10.Text) Then
                Label10.Text = maxVal.ToString
            End If
            Integer.TryParse(Label10.Text, value)
            If value >= 1 And value <= maxVal Then
                value -= 1
                Label10.Text = value.ToString
            Else
                If value <= 0 Then
                    Button5.PerformClick()
                    Timer1.Stop()
                    Label10.Text = maxVal.ToString
                End If
            End If
        Catch ex As Exception

        End Try
    End Sub






    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        Try
            For i As Integer = 0 To ComboBox2.Items.Count - 1
                ComboBox2.SelectedIndex = i
                Dim d As DateTime = DateTime.Now
                Dim parsedate As DateTime = ComboBox2.Items(i).ToString
                Dim d2 As DateTime = DateTime.ParseExact(parsedate, "dd/MM/yyyy HH:mm:ss", System.Globalization.CultureInfo.CurrentCulture)
                Dim ts As New TimeSpan((d - d2).Ticks)
                Dim dysdiff As Integer = ts.TotalDays
                Dim cbNum As Integer = 365 - dysdiff
                ComboBox3.Items(i) = cbNum.ToString
                If -10 <= cbNum AndAlso cbNum <= -1 Then
                    ComboBox3.Items(i) += " old post"
                End If
            Next
        Catch ex As Exception

        End Try
    End Sub
xrjf 230 Posting Whiz

You are welcome. I can change the audio file, click the Play button again and it works for me.
Also, I found that BtnStop_Click() should test for Nothing:

    Private Sub BtnStop_Click(sender As Object, e As EventArgs) Handles btnStop.Click
        If outDev IsNot Nothing Then
            outDev.Stop()
        End If
    End Sub
xrjf 230 Posting Whiz

Sorry about that. I forgot the device number:

    Private Sub BtnPlay_Click(sender As Object, e As EventArgs) Handles btnPlay.Click
        Try
            If outDev Is Nothing Then
                outDev = New WaveOut()
                outDev.DeviceNumber = devNum ' Here you set the Device Number '
            End If
            If reader Is Nothing Then
                reader = New AudioFileReader(sFile)
                outDev.Init(reader)
            End If
            outDev.Play()
        Catch ex As Exception
        End Try
    End Sub
xrjf 230 Posting Whiz

Yes, devnum is the sound card you will be using, but if I were you, I would stick to the sample. After Googling this is what it is said about employing two sound cards at a time:

«Can you run 2 sound cards at the same time?
In most cases you'll be able to run several different soundcards side by side without problems, although there are no guarantees, and some rare combinations may suffer from audio clicks and pops, or cause your computer to crash occasionally or even refuse to boot up at all.»

xrjf 230 Posting Whiz

Here is a sample out from the documentation translated into VB.NET.

Imports System.ComponentModel
Imports NAudio.Wave

Public Class Form1
    Dim devNum As Int32
    Dim sFile As String
    Dim reader As AudioFileReader
    Dim outDev As WaveOut
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Try
            Dim i As Int32
            For i = -1 To WaveOut.DeviceCount - 1
                Dim woc As WaveOutCapabilities = WaveOut.GetCapabilities(i)
                ComboBox1.Items.Add(woc.ProductName)
            Next
            ComboBox1.SelectedIndex = 0
            With OpenFileDialog1
                .Filter = "All Media Files|*.wav;*.aac;*.wma;*.wmv;*.avi;*.mpg;*.mpeg;*.m1v;*.mp2;*.mp3;*.mpa;*.mpe;*.m3u;*.mp4;*.mov;*.3g2;*.3gp2;*.3gp;*.3gpp;*.m4a;*.cda;*.aif;*.aifc;*.aiff;*.mid;*.midi;*.rmi;*.mkv;*.WAV;*.AAC;*.WMA;*.WMV;*.AVI;*.MPG;*.MPEG;*.M1V;*.MP2;*.MP3;*.MPA;*.MPE;*.M3U;*.MP4;*.MOV;*.3G2;*.3GP2;*.3GP;*.3GPP;*.M4A;*.CDA;*.AIF;*.AIFC;*.AIFF;*.MID;*.MIDI;*.RMI;*.MKV"
            End With
        Catch ex As Exception
        End Try
    End Sub

    Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
        devNum = ComboBox1.SelectedIndex - 1
    End Sub

    Private Sub Btn_File(sender As Object, e As EventArgs) Handles btnFile.Click
        OpenFileDialog1.ShowDialog()
    End Sub
    Private Sub OpenFile() Handles OpenFileDialog1.FileOk
        Try
            CloseAudio() ' Close if it's not first audio to play '
            sFile = OpenFileDialog1.FileName
            Dim vNom() As String = Split(sFile, "\")
            ' Get Audio File Name: '
            lblFile.Text = "File: " + vNom(vNom.Length - 1).Split(".")(0)
        Catch ex As Exception
        End Try
    End Sub

    Private Sub BtnPlay_Click(sender As Object, e As EventArgs) Handles btnPlay.Click
        Try
            If outDev Is Nothing Then
                outDev = New WaveOut()
            End If
            If reader Is Nothing Then
                reader = New AudioFileReader(sFile)
                outDev.Init(reader)
            End If
            outDev.Play()
        Catch ex As Exception
        End Try
    End Sub
    Private Sub btnStop_Click(sender As Object, e As EventArgs) Handles btnStop.Click
        outDev.Stop()
    End Sub
    Private Sub CloseAudio()
        Try
            If outDev IsNot Nothing Then
                outDev.Stop()
                outDev = Nothing
            End If
            If reader IsNot Nothing Then
                reader.Dispose()
                reader = Nothing
            End If
        Catch ex As Exception …
rproffitt commented: Most excellent example. +1 +16
xrjf 230 Posting Whiz

Basically, it would go like this:

    Dim devNum As Int32
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Try
            Dim i As Int32
            For i = -1 To WaveOut.DeviceCount - 1
                Dim woc As WaveOutCapabilities = WaveOut.GetCapabilities(i)
                ComboBox1.Items.Add(woc.ProductName)
            Next
            ComboBox1.SelectedIndex = 0
        Catch ex As Exception
        End Try
    End Sub

    Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
        devNum = ComboBox1.SelectedIndex - 1
    End Sub
xrjf 230 Posting Whiz

Also, you may consider reading NAudio's document "Understanding Output Devices" Here

xrjf 230 Posting Whiz

Perhaps this link may help you.
Click Here

xrjf 230 Posting Whiz

Be aware that all string or numeric comparisons must be between the same type:

  1. Number compared to Number or
  2. String compared to String.
    Never Number compared to String, or String compared to Number.

Line# 9:

If ComboBox3.Text.ToString >= 1 <= 10 Then 

compares ComboBox3.Text.ToString, i.e. a String, with numbers (also >= 1 <= 10 is a syntax error and, as ComboBox3.Text is already a String, the trailing .ToString is not necessary).

Therefore consider converting line#9 to a valid comparison:

 Public Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
        Try
            For i As Integer = 0 To ComboBox3.Items.Count - 1
                ComboBox2.SelectedIndex = i
                Dim d As DateTime = DateTime.Now
                Dim parsedate As DateTime = ComboBox2.Items(i).ToString
                Dim d2 As DateTime = DateTime.ParseExact(parsedate, "dd/MM/yyyy HH:mm:ss", System.Globalization.CultureInfo.CurrentCulture)
                Dim dysdiff As Integer = (d - d2).Days
                ComboBox3.Items(i) = (365 - dysdiff).ToString
                Dim cbNum As Integer
                Integer.TryParse(ComboBox3.Text, cbNum)
                ' Compare pairs of numbers: '
                ' Numeric cbNum compared to number 1 '
                ' Numeric cbNum compared to number 10 '
                If cbNum >= 1 AndAlso cbNum <= 10 Then
                    MsgBox("post old", MessageBoxButtons.OK)
                End If
            Next
        Catch ex As Exception

        End Try
    End Sub
xrjf 230 Posting Whiz

If needed a countdown you could do the following and get the countdown in Label10:

    Const maxVal As Integer = 30
    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        Try
            Dim value As Integer = maxVal ' default value 30 '
            Integer.TryParse(Label10.Text, value) ' if Label10 has a valid value assign it to value '
            If value >= 1 And value <= maxVal Then
                value -= 1
                Label10.Text = value.ToString
            Else
                If value <= 0 Then
                    Form11.Button5.PerformClick()
                    Timer1.Stop()
                    Label10.Text = maxVal.ToString
                End If
            End If
        Catch ex As Exception    
        End Try
    End Sub

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Label10.Text = maxVal.ToString
    End Sub
xrjf 230 Posting Whiz

Why not just supress the traling .toString and set value as an Integer?

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        Dim value As Integer = CInt(Label10.Text)
        If value >= 1 And value <= 30 Then
            value -= 1
        Else
            If value <= 0 Then
                Form11.Button5.PerformClick()
                Timer1.Stop()
            End If
        End If
    End Sub
xrjf 230 Posting Whiz

Time format is "HH:mm:ss" and not "hh:mm:ss" so I think you should change instruction:

 Dim d2 As DateTime = DateTime.ParseExact(parsedate.ToString, "dd/MM/yyyy hh:mm:ss", System.Globalization.CultureInfo.CurrentCulture)

into:

 Dim d2 As DateTime = DateTime.ParseExact(parsedate.ToString, "dd/MM/yyyy HH:mm:ss", System.Globalization.CultureInfo.CurrentCulture)
xrjf 230 Posting Whiz

You are welcome.
Look at the contents of parsedate, most probably it is formated as "MM/dd/yyyy hh:mm:ss" and not as "dd/MM/yyyy hh:mm:ss" as expected.

xrjf 230 Posting Whiz

I am not sure what you are trying to do. At a guess, you may replace line #6 by:

        ComboBox3.Items(i) = (365 - dysdiff).ToString + " Days"
        ComboBox3.SelectedIndex = i
xrjf 230 Posting Whiz

You may add a timer and in Timer.tickevent call to Button5_Click(sender, e).
BTW, number 365 in line#7 is numeric and dysdiffis a string, so it's not possible the substraction to work.

xrjf 230 Posting Whiz

Let's see if (I am right and) I can explain the difference between My.Settings.Reload and My.Settings.Reset.
Reload recovers the values from design time, i.e., the values you enter manually in the application's settings.
Reset recovers the values saved in the last call to My.Settings.Save.

xrjf 230 Posting Whiz

Are you asking for this?:

            For Each prop As System.Configuration.SettingsProperty In My.Settings.Properties
                prop.DefaultValue = ""
            Next
xrjf 230 Posting Whiz

Try renaming size, for example sz.

xrjf 230 Posting Whiz

Did you replace criket by tennis in line number 41? Do you receive any error message?

xrjf 230 Posting Whiz

Line# 41 should be tennis, isn' it? Also, n1, n2, n3 and total aren't intialized to zero.

vaishnavi_13 commented: i initialized the ni,n2,n3 and total but intersection of set c and set a and union of set a,b,c result is not being displayed +0
xrjf 230 Posting Whiz

You may do:

    Public Sub Btn_Click(sender As System.Object, ByVal e As System.EventArgs)
        Try
            Dim btn As Button
            Dim cbx As ComboBox
            Dim txt As TextBox
            Select Case sender.GetType
                Case GetType(Button)
                    btn = CType(sender, Button)
                   ' TODO ... '

                Case GetType(ComboBox)
                    cbx = CType(sender, ComboBox)
                   ' TODO ... '

                Case GetType(TextBox)
                    txt = CType(sender, TextBox)
                    ' TODO ... '

            End Select
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub
xrjf 230 Posting Whiz

Try this:

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Try
            Dim sSearch As String = LCase(TextBox1.Text)
            If sSearch = "" Then Exit Try
            Dim line As Int32 = 0
            TextBox2.Text = ""
            For Each row As String In File.ReadAllLines("Test.csv")
                ' split the fields from the row '
                line += 1
                Dim vFields() As String = Split(row, ";")
                Dim iLbl As Int32 = 0
                For iLbl = 0 To vFields.Length - 1
                    If InStr(LCase(vFields(iLbl)), sSearch) Then
                        Exit For
                    End If
                Next
                If iLbl < vFields.Length Then
                    ' Found: " '
                    TextBox2.Text += "line#=" + line.ToString + " "
                    ' TextBox2 is Multiline '
                    '                                A  B  D  AA  AB '
                    Dim vColumnsToShow() As Int32 = {0, 1, 3, 26, 27}
                    Dim vLabel() As String = {"A", "B", "D", "AA", "AB"}
                    For iLbl = 0 To vColumnsToShow.Length - 1
                        Dim Col_in_Excel As Int32 = vColumnsToShow(iLbl)
                        If Col_in_Excel < vFields.Length Then
                            TextBox2.Text += "cell " + vLabel(iLbl) + "= " + vFields(Col_in_Excel) + " "
                        End If
                    Next
                    TextBox2.Text += vbCrLf
                End If

            Next
        Catch ex As Exception
            MessageBox.Show("Error : " & ex.Message)
        End Try
    End Sub
fnaf commented: Thanks a lot for your help. +0
jwatson commented: Yes i try, its working. . Thanks guys. +3
xrjf 230 Posting Whiz

Employ CheckChanged event:

    Private Sub CheckBox3_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox3.CheckedChanged
        If CheckBox3.Checked = True Then
            TextBox7.Text += fntext & vbCrLf
        End If
    End Sub
    Private Sub CheckBox4_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox4.CheckedChanged
        If CheckBox4.Checked = True Then
            TextBox7.Text += artext & vbCrLf
        End If
    End Sub
    Private Sub CheckBox5_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox5.CheckedChanged
        If CheckBox5.Checked = True Then
            TextBox7.Text += dltext & vbCrLf
        End If
    End Sub
xrjf 230 Posting Whiz

Of course the for-next can be replaced by an AddRange

xrjf 230 Posting Whiz

I would do the following:

    Private Sub TextBox3_TextChanged(sender As Object, e As EventArgs) Handles TextBox3.TextChanged
        Dim items = (From it In ListBox1.Items Select it
                     Where it.ToString().IndexOf(TextBox3.Text, 
                     StringComparison.CurrentCultureIgnoreCase) >= 0).ToArray
        ListBox1.BeginUpdate()
        ListBox1.Items.Clear()
        For Each item As Object In items
            ListBox1.Items.Add(item)
        Next
        If String.IsNullOrEmpty(TextBox3.Text) Then
            ListBox1.Items.AddRange(My.Settings.userlist.ToString)
        End If
        ListBox1.EndUpdate()
    End Sub
xrjf 230 Posting Whiz

Probably the code is missing the following Imports:

Imports Microsoft.VisualBasic.DateAndTime
shane1961 commented: Hi xrjf. That was the problem. Many thanks. +0
xrjf 230 Posting Whiz

Here is the series solution and an alternative solution. In you can opt for any of both, solution #2 is more accurate, more concise and faster. I hope you can understand and tranlate the VB.Net code:

        Dim sum As Double = 0
        Dim fact As BigInteger = 1
        Dim esx As String = InputBox("x = ?")
        Dim x As Double = Double.Parse(esx)
        Dim x0 As Double = x
        Dim es As String = InputBox("n = ?")
        Dim n As Int32 = Int32.Parse(es)
        es = InputBox("solution 1/2")
        If es = "1" Then
            ' Solution #1 '
            sum = 1 + x
            For i As Int32 = 1 To n
                x *= x
                fact *= i + 1
                sum += x / CType(fact, Double)
            Next
        Else
            ' Solution #2 '
            ' exp(x) = lim(1+x/n)^n when n->Infinity  '
            sum = Math.Pow(1 + x / n, n)
        End If
        TextBox1.Text = sum.ToString + " " + Math.Exp(x0).ToString
xrjf 230 Posting Whiz

Hello. The most easiest way I see to do what you ask is the following:

            Dim Search1, Search2, Search3, Search4, Search5, Search6, Search7 As String
            Dim s As String = tbxCustomerName.Text
            Dim words As String() = Split(s, " ")
            For i as Int32 = 0 To words.Length - 1
                Select Case i
                    Case 0 : Search1 = words(0)
                    Case 1 : Search2 = words(1)
                    Case 2 : Search3 = words(2)
                    Case 3 : Search4 = words(3)
                    Case 4 : Search5 = words(4)
                    Case 5 : Search6 = words(5)
                    Case 7 : Search7 = words(6)
                End Select
            Next
xrjf 230 Posting Whiz

I found the following in your code:

  1. There is missing a Exit Sub right after Messagebox in between lines 30 and 31.
  2. Line 46 where variable i is incremented, should go before Loop in line 45.
  3. In line 36 you are comparing strProductos(i) (which is a String) with intProducto defined as Integer. You must compare strings with strings or, integers with integers.
    So, you could change line 36
    If strProductos(i) = intProducto Then
    into
    If strProductos(i) = txtNumeroProducto.Text Then
    In this way you will be comparing two strings.