Click here to Skip to main content
15,308,025 members

Comments by 555336 (Top 73 by date)

555336 2-May-11 14:32pm View
@SAKryukov, I got the answer...Append in streamwriter does create
555336 2-May-11 10:40am View
No, I have declared my filename. my text file is in the debug folder, so I put:

555336 2-May-11 10:37am View
I did read this article, I posted this because some people are not believing me that only Append can create a file if it does not exist. It is not necessary to add a Boolean of Create filestream. I just need a confirmation of 'Yes' or 'No' from you that's all. Because on my PC it does create the text file even it does not exist.
555336 2-May-11 7:17am View
Does Append ONLY also create?
555336 2-May-11 6:48am View
I'm new in that's why I want a confirmation if Append also many are saying only Create which creates file not Append. Even I have read many articles, they did not mention that Append also creates.
555336 2-May-11 6:45am View
Of course man, and believe me, it creates the text file if it does not exist even I used Append. I'm posting this to confirm from you all as I want all opinions.
555336 1-May-11 5:06am View
I have not yet known the StreamWriter functions that's why I asked this quiestion.

I find it cool then if Appen can create as we may not implement a code to know if the file exist do not create or if not exists, create. I mean we may not use both Create and Append when one of them is doing both jobs.

I have a problem on Deployment, can you help me here?
555336 1-May-11 5:03am View
where to insert that? in my form?
555336 30-Apr-11 13:36pm View
You mean add an icon to it? When I right click on both User's program menu and User's desktop, on the property?

By the way, I don't need an icon, but when I click on the icon after installing it, it is the folder where it is stored in the Program files in drive C which is opening.
555336 30-Apr-11 11:11am View
I will not be able to implement it right now, but tell me, so Append also creates then even you have not put the Create in your code?
555336 28-Apr-11 7:38am View
Yes I did implement my code for buttons. But as I said, when the user erase or delete with keyboard or mouse, the button does not return disabled as the field is blank when he does that.

The name checkboxes can be changed, I changed mine.
555336 28-Apr-11 7:27am View
555336 28-Apr-11 7:08am View
Nope does not work. I forgot to say that I have a pretext also on my textbox only.
555336 27-Apr-11 6:42am View
But I'm a beginner and my program is very simple. Just a form to fill some fields and save to a text file that's all. But as you said, the code I implemented above is right, so I prefer to leave it like this.
555336 27-Apr-11 6:10am View
I did this:

Using textfilestream As System.IO.TextWriter = System.IO.File.AppendText("C:\test.txt")
End Using
555336 27-Apr-11 5:27am View
Yes I included it and the warning disappeared. thank you.
555336 27-Apr-11 5:22am View
i got the answer on MSDN. I just add Using and End using with and remove the DIM :) finally it works. Thank you all. Your answers also are good when I was searching.
555336 27-Apr-11 5:12am View
Read the warning it is giving me in the question below.
555336 27-Apr-11 4:50am View
How to do that? I'm new in Here is my full code of it: Dim textfilestream As System.IO.TextWriter textfilestream = System.IO.File.AppendText("C:\Test.txt") textfilestream.WriteLine("xxxx") textfilestream.Flush() MessageBox.Show("You saved your work!")
555336 27-Apr-11 4:49am View
How to do that? I'm new in

Here is my full code of it:

Dim textfilestream As System.IO.TextWriter
textfilestream = System.IO.File.AppendText("C:\Test.txt") textfilestream.WriteLine("xxxx")
MessageBox.Show("You saved your work!")
555336 27-Apr-11 4:18am View
here is the code:

Dim textfilestream As System.IO.TextWriter
textfilestream = System.IO.File.AppendText("C:Test.txt")
555336 27-Apr-11 4:02am View
What you mean?
555336 13-Apr-11 12:07pm View
no you have not understood, i thought the numeric accepts only numbers that it is generated, but in reality when you are typing on it, it seems it is accepting . and '
555336 8-Apr-11 11:05am View
here is my code, still have problem when the message box stops, it displays all the forms together. All I want is when the message box stops, then it display the first form then stop to display the second then stop to display the last. The first form must stay for 3 seconds on the screen, then after 3 seconds the second appears then after 5 seconds the last appears.

Private Sub frmblabla_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load


Private Sub tmrnote_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrnote.Tick

Static iCount As Integer
If iCount < 10 Then MsgBox("I got you!", vbCritical, "LOL")
iCount = iCount + 1
If iCount < 100 Then i1.Show()
iCount = iCount + 3
If iCount < 100 Then i2.Show()
iCount = iCount + 5
End Sub
End Class
555336 8-Apr-11 10:53am View
but my interval in the timer's properties will remain 100 as default right?
555336 7-Apr-11 17:26pm View
but when it stops, i want to make another form to appear, how to do that?
555336 4-Apr-11 12:09pm View
555336 4-Apr-11 11:41am View
No its the same. Ok, I will explain well.

I have a combobox which has 3 items namely Red, Blue, Black and Green. When Red or Blue is selected, the maskedtextbox is disabled else it is enabled for the other colours if selected.

when I select Red or Blue, the maskedtextbox is disabled, good, but the problem is I still can't save as even disabled when selected these colours, i get the message box to prompt me to fill it.
555336 4-Apr-11 10:16am View
i did mtxtime.maskcompleted = false and it works

but the problem, i have a combobox where a specific item is selected, the masktextbox should be disabled automatically. however, when im doing what you told me, it is not letting me save now as it is recognising that the masttextbox is blank even disabled.
555336 4-Apr-11 10:11am View
i did mtxttime.maskcompleted = ""

is it good?
555336 3-Apr-11 10:36am View
lol thank you I did it before you replied lol. i used my brain :)
555336 1-Apr-11 12:38pm View
yes...have to show that to my lecturer.
555336 1-Apr-11 12:38pm View
is in this problem lol
555336 1-Apr-11 8:10am View
i will contact you soon by your email, because i have to discuss that with my lecturer about your codes etc... in fact many friends are the same boat, o doubt our lecturer must intervene now.
555336 1-Apr-11 8:08am View
if the code above is good, then it is the same dear.. All i want is if the Search has not found any results, at least it could display all letters and sentence which are related.
555336 1-Apr-11 8:06am View would be great if we contact through email.

By the way, I think i have not put some details in my explanation, well normally, if the search query cannot find a result, atleast it gives a messagebox saying "We have not found your results but we are giving you some suggestions", then it gives all letters and sentences related to the search
555336 1-Apr-11 7:54am View
well, I tested it, for example if im searching the word 'Love' in my text
555336 1-Apr-11 7:37am View
wait wait wait dear...i think its testing it again then tell you...
555336 1-Apr-11 7:33am View
What I did it I paste all codes in the Form1.vb' on the my form. I replaced your textfile which ie 'E:/.....mobydick2.txt' to my text file C:\Test.text', and now it says 'E:/....mobydick2.txt' does not exist! In fact I did change it..
555336 1-Apr-11 7:18am View
ok I made a new project, where a form
Now where to insert the SoundexLibrary.vb?
555336 1-Apr-11 5:55am View
i have read your codes dear... if you can, just tell me what you included in the form in terms of objects and i will rebuit the application again and paste the code in VB 2005.
555336 1-Apr-11 5:51am View
oh no lol, i have VB 2005 and it is not opened! :( by the way, can you just paste the code here?
555336 1-Apr-11 5:49am View
Well, I changed the code below and tell me if it is good because it is the same as results.

Dim wordsSearch() As String = txtSearch.Text.ToLower.Split(" ")
Dim lines() As String = IO.File.ReadAllLines("c:\test.txt")
Dim PointsArray(lines.Length - 1) As Integer
Dim wordToSearch As String

'Set all values to 0
For count2 As Integer = 0 To PointsArray.Length - 1
PointsArray(count2) = 0

'Search in text
For x As Integer = 0 To lines.Length - 1
Dim words() As String = lines(x).Split(" ")
For a As Integer = 0 To wordsSearch.Length - 1
wordToSearch = wordsSearch(a)
For y As Integer = 0 To words.Length - 1
If 0 <= words(y).Length - wordToSearch.Length And (words(y).Length - wordToSearch.Length) < 2 Then 'The length of the word may be 1 element 1 longer (e.g. a "." or a "?")
Dim counter As Integer = 0
For z As Integer = 0 To wordToSearch.Length - 1

If words(y).Substring(z, 1) = wordToSearch.Substring(z, 1) Then
counter += 1
If words(y).length - 1 = z Then
End If
If counter > wordToSearch.Length - 2 Then
PointsArray(x) += 1
End If
End If

'Make a list with all the lines
Dim ArrayLines(lines.Length - 1) As Integer

For x As Integer = 0 To lines.Length - 1
ArrayLines(x) = x

'Sort: 'Implemented from wiki -
Dim i As Integer
Dim v As Boolean
Dim j As Integer
Dim temp As Integer
Dim temp2 As Integer
Dim count As Integer = PointsArray.Length - 1

i = 0
v = True
Do While i < count - 1 And v = True
v = False
j = 0
Do While j <= count - i - 1
If PointsArray(j) > PointsArray(j + 1) Then
temp = PointsArray(j)
PointsArray(j) = PointsArray(j + 1)
PointsArray(j + 1) = temp
'Sort also the array with the lines....
temp2 = ArrayLines(j)
ArrayLines(j) = ArrayLines(j + 1)
ArrayLines(j + 1) = temp2
v = True
End If
j = j + 1
i = i + 1

'Now, we can show the result (Say, only the first 5)
Dim results As Integer = PointsArray.Length - 6
If results < 0 Then
results = 0
End If
For i = PointsArray.Length - 1 To results Step -1
If PointsArray(i) = 0 Then 'If the line has no "points"
Exit For
End If
txtNew.Text += "Line nr. " + ArrayLines(i).ToString + " :" + lines(ArrayLines(i)) + vbNewLine
555336 31-Mar-11 17:55pm View
Ok thank you I will do it in the next hours then will tell you.
555336 31-Mar-11 14:49pm View
Ok I will add it in some minutes. Im having a break. I will tell u then.
555336 31-Mar-11 9:27am View
Yes I tried the code by pasting directly and no errors found but i dont know where to insert a code or modify the current one to search the text in my text file and where to insert the code to display the results in my textbox
555336 31-Mar-11 3:45am View
The solution 3 seems good for me, but don't know where to insert the code to search the text file in my drive c and to display the results in the textbox. What you think of Soundex? I just read it 15 minutes ago.
555336 31-Mar-11 3:44am View
Hi Henry thank for posting, as I said I'm new in VB since 2 weeks, by the way can you help me how and where to insert the code where to search from my text file in drive C? and also where to insert the code to appear the results on a text box?
555336 30-Mar-11 17:58pm View
If I change 0 to -1, you mean everything on the code must change?

By the way I'm new in VB since 2 weeks. So understanding these codes fluently is quite difficult for me. Can I have your email? I have 2 small problems related to search items, I can give you my email.
555336 30-Mar-11 13:51pm View
hi dear...i think its the same...for example if im searching the word LOVE, and typing it as 'Lov', im getting a result, but if I type 'Lovee', im not getting, why?
555336 27-Mar-11 7:07am View
it says "Split" is not a member of an array, underline by the blue colour, only this, why?

this sentence is underlined: IO.File.ReadAllLines("c:\test.txt").Split
555336 26-Mar-11 14:20pm View
I'm getting the blue underline on the section where you stated "line.count" and "words.count". sorry im new in VB and it it is telling me that they are not a member in array. what should i insert so that the blue underline is removed?
555336 26-Mar-11 14:17pm View
Can you implement it with an array for me? Im new in VB.
555336 25-Mar-11 7:25am View
Yes...I did see this tutorial, the onlu thing is that this code will be in the btnOK event where the user has to click on it and get the results, but the only problem I'm having, I dont know know how to do a code for the textbox where the user will put a word then click on the button to search.
555336 25-Mar-11 7:10am View
555336 25-Mar-11 7:01am View
Well the word "love" is only an example, the user can search other words also! I don't know how to put the coding.
555336 22-Mar-11 13:42pm View
Imagine there is search box (textbox), and below there are a search button
Thank you!
555336 22-Mar-11 6:59am View
ok I will post it soon. thanks man
555336 22-Mar-11 6:55am View
If I didn't try, I would not post it here man!
555336 22-Mar-11 6:20am View
I want a code with string arrays.
555336 21-Mar-11 15:20pm View
Hi, by the way I have already managed and I did it. Thank you for your time and help friend. However, Im having immense difficulties doing a search box.

Well, I have to do a search textbox, which will be based on two categories of search.

When a user makes a query, he has to get results from a text file in the drive C.

I included a combobox with two items namely: Product and All categories.

How to do a code, when the user will select "Product" on the combobox, he has to get the results on a richtextbox included in the form? The search box also should have a feature where if the the user mmakes a misspelling mistake, he will get the results as well.

Can you help me in terms of streamreader on itt as it must read the text file in the drive C.

Thank you
555336 21-Mar-11 5:53am View
:) By the way, do you know how to create a search box in Visual Basic? I want the search box based on streamreader. In proper terms, when I will input a text, it has to read on a text file in drice C. I know the streamreader code but don't know the code to do a search.
555336 21-Mar-11 5:02am View
Hey friend, I did it, yes, I managed and finally got the good code by playing on the event. Look what I put:

End Select
555336 21-Mar-11 4:53am View
Does not work dear, my codes below:

End Select
555336 20-Mar-11 17:18pm View
I must get this code because I will use the same procedure when I will do a form which will include 3 categories of search in one. And what's disturbing, there is no tutorial on how to do a search box on youtube and internet. The search should take information from the streamwriter text file. I think I will do it by the streamreader method, but don't know to do a search. I'm so poor in programming.
555336 20-Mar-11 14:32pm View
Thank you
555336 20-Mar-11 13:19pm View
Oh no sorry dear, even when I write only one item, it disables the masktextbox completely.
555336 20-Mar-11 13:17pm View

555336 20-Mar-11 13:04pm View
Well here are properties for combobox and maskedtextbox below:

Combobox: cboType
Maskedtextbox: txtCost

I included what you said, but it is is still enable when choosing an item in t

Why it is not functioning?
555336 20-Mar-11 12:27pm View
Well I have a combobox with 3 items namely: Product Size and Cost.

I have also a maskedtextbox.

If I select "Product" and "Size" on the combobox, I want to disable the maskedtextbox from filling, how must I do it?
555336 20-Mar-11 12:13pm View
THANK YOU IT WORKS. Can you help me in a last problem?
555336 20-Mar-11 6:06am View
Visual Basic
555336 20-Mar-11 6:06am View
Hello, I tried the above examples and they work thank you. But there is a problem, I have included a combobox, numecicupanddown and a maskedtextbox as well.

However, I am having difficulties when doing the coding for the three above. For example, my combo box is 'cboDrawer', so when I do:

If Not cboDrawer.Text = " " Then
btnSave.Enabled = True
End If

it does not work, as there is no 'Text' after I put the 'cboDrawer.' compared to the other textboxes. For numericupanddown and maskdtextbox also the same.

How to do that?