Click here to Skip to main content
16,006,013 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Questionhow can we View the Finded data in Datagrid Pin
mani_tac18-Sep-05 19:52
mani_tac18-Sep-05 19:52 
QuestionCurrency format Pin
dennysoe18-Sep-05 18:37
dennysoe18-Sep-05 18:37 
GeneralRe: Currency format Pin
Gopi.V18-Sep-05 22:21
Gopi.V18-Sep-05 22:21 
GeneralRe: Currency format Pin
dennysoe19-Sep-05 16:39
dennysoe19-Sep-05 16:39 
Questioncreate strings by one giving string Pin
LyBun18-Sep-05 18:28
LyBun18-Sep-05 18:28 
AnswerRe: create strings by one giving string Pin
Steve Pullan18-Sep-05 18:46
Steve Pullan18-Sep-05 18:46 
AnswerRe: create strings by one giving string Pin
Steve Pullan19-Sep-05 17:54
Steve Pullan19-Sep-05 17:54 
AnswerRe: create strings by one giving string Pin
Steve Pullan20-Sep-05 13:07
Steve Pullan20-Sep-05 13:07 
LyBun wrote:
Dear steve
First I thank you to give the solution .but we still got some problem with the solution . It is when we create other one like "sole" , "coub" or "bkoa" it can't give the correct answer .It is maybe I tell the condition not clear . so I say again
1 the charater "s" can become to charater "a" and "c" but the "a" can also become to "s" and "c" . the "c" can also become to "s" and "a"
2 the charater "m" become to charater "k" ,"l" and "u" ."k" also can become to "m" ,"u" and "l" . "l" also can become to "m" , "u" and "k" . "u" can also become to "m" , "k" and "l" .
3 the charater "e" can become to charater "b" and "h" the same with the 3 one .
when I change your code it run out of stack space . How to correct the code to avoid the error
The code change is :
Sub test2(str As String, ByRef wd As Scripting.Dictionary)

Dim ch As String
Dim ch1 As String
Dim ch2 As String
Dim wlen As Integer
Dim i As Integer

wlen = Len(str)

For i = 1 To wlen

ch1 = Left(str, i - 1)
ch = Mid(str, i, 1)
ch2 = Mid(str, i + 1, wlen)

Select Case ch

Case "s"
Call test2(ch1 & "a" & ch2, wd)
Call test2(ch1 & "c" & ch2, wd)
Case "a"
Call test2(ch1 & "s" & ch2, wd)
Call test2(ch1 & "c" & ch2, wd)
Case "c"
Call test2(ch1 & "s" & ch2, wd)
Call test2(ch1 & "a" & ch2, wd)
Case "m"
Call test2(ch1 & "k" & ch2, wd)
Call test2(ch1 & "l" & ch2, wd)
Call test2(ch1 & "u" & ch2, wd)
Case "k"
Call test2(ch1 & "m" & ch2, wd)
Call test2(ch1 & "l" & ch2, wd)
Call test2(ch1 & "u" & ch2, wd)
Case "l"
Call test2(ch1 & "k" & ch2, wd)
Call test2(ch1 & "m" & ch2, wd)
Call test2(ch1 & "u" & ch2, wd)
Case "u"
Call test2(ch1 & "k" & ch2, wd)
Call test2(ch1 & "l" & ch2, wd)
Call test2(ch1 & "m" & ch2, wd)
Case "e"
Call test2(ch1 & "b" & ch2, wd)
Call test2(ch1 & "h" & ch2, wd)
Case "b"
Call test2(ch1 & "e" & ch2, wd)
Call test2(ch1 & "h" & ch2, wd)
Case "h"
Call test2(ch1 & "b" & ch2, wd)
Call test2(ch1 & "e" & ch2, wd)

Case Else

End Select

Next

If Not wd.Exists(str) Then

Debug.Print str

wd.Add str, str
End If

End Sub

Hope see your answer soon .
Thanks!!!!!

Regards,
bun


Bun,

The problem with what you are trying to do is that you'll cause an infinite recursion loop in test2() since "a" can replace "s" and "s" can replace "a" etc..., and hence that is why you get the stack overflow error.

I should have asked this question in the first place, but what are you actually trying to achieve? Is this some real world application or just a programming exercise? Is it a condition of the algorithm that multiple substitutions are permitted or is only one pass over the initial input string to be performed?

...Steve
QuestionInsert values into SQL database from webform Pin
BORN...again!18-Sep-05 15:34
BORN...again!18-Sep-05 15:34 
AnswerRe: Insert values into SQL database from webform Pin
tatchung18-Sep-05 16:09
tatchung18-Sep-05 16:09 
GeneralRe: Insert values into SQL database from webform Pin
BORN...again!18-Sep-05 16:26
BORN...again!18-Sep-05 16:26 
GeneralRe: Insert values into SQL database from webform Pin
tatchung18-Sep-05 16:47
tatchung18-Sep-05 16:47 
AnswerRe: Insert values into SQL database from webform Pin
Edbert P18-Sep-05 20:55
Edbert P18-Sep-05 20:55 
QuestionDatabinding to datagrid Pin
SLG3118-Sep-05 9:23
SLG3118-Sep-05 9:23 
AnswerRe: Databinding to datagrid Pin
KaptinKrunch18-Sep-05 17:37
KaptinKrunch18-Sep-05 17:37 
GeneralRe: Databinding to datagrid Pin
SLG3118-Sep-05 22:00
SLG3118-Sep-05 22:00 
QuestionJoystick/Gamepad Pin
Jerry___18-Sep-05 8:28
Jerry___18-Sep-05 8:28 
AnswerRe: Joystick/Gamepad Pin
Christian Graus18-Sep-05 11:05
protectorChristian Graus18-Sep-05 11:05 
GeneralRe: Joystick/Gamepad Pin
Jerry___18-Sep-05 12:05
Jerry___18-Sep-05 12:05 
GeneralRe: Joystick/Gamepad Pin
Christian Graus18-Sep-05 12:12
protectorChristian Graus18-Sep-05 12:12 
GeneralRe: Joystick/Gamepad Pin
Jerry___19-Sep-05 0:32
Jerry___19-Sep-05 0:32 
GeneralRe: Joystick/Gamepad Pin
Dave Kreskowiak19-Sep-05 1:04
mveDave Kreskowiak19-Sep-05 1:04 
GeneralRe: Joystick/Gamepad Pin
Jerry___19-Sep-05 3:06
Jerry___19-Sep-05 3:06 
GeneralRe: Joystick/Gamepad Pin
Dave Kreskowiak19-Sep-05 5:15
mveDave Kreskowiak19-Sep-05 5:15 
GeneralRe: Joystick/Gamepad Pin
Jerry___19-Sep-05 8:48
Jerry___19-Sep-05 8:48 

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.