|
Ok its good idea , bud i am from Czech and books for vb in czech language ....
|
|
|
|
|
You still have to do your own work.
If you really want an application without doing the work (or paying for a pre-existing product) then go to rentacoder[^] and pay to have someone make it.
|
|
|
|
|
No. The code itself is quite simple - apart from the regular expression, so this shouldn't be too difficult. If you want somebody to do your work for you, become a manager.
|
|
|
|
|
I have successfully load a dynamic array reading the numbers in a text file into form. But how can I save that array again into text file after I change some numbers.
Private Sub LoadButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LoadButton.Click
Dim lin(8) As String, filRead As StreamReader, i, x, t, d As Integer
Dim openFile As New OpenFileDialog()
openFile.Filter = "txt.Files(*.txt)|*.txt"
openFile.InitialDirectory = "\C:TextFile1.txt"
If openFile.ShowDialog() = DialogResult.OK Then
MessageBox.Show(openFile.FileName)
End If
filRead = New StreamReader(openFile.FileName)
'diff = CByte(filRead.ReadLine())
For r As Integer = 1 To 3
For rr As Integer = 1 To 3
lin = filRead.ReadLine.Split() : i = 0
For c As Integer = 1 To 3
For rc As Integer = 1 To 3
If lin(i) <> "00" Then
x = Integer.Parse(lin(i))
If x > 0 Then xx(r, c).rec(rr, rc).ForeColor = Color.Red
x = Abs(x)
xx(r, c).rec(rr, rc).Text = x.ToString
For j As Integer = CInt(Int(Log10(x))) To 0 Step -1
If j = 0 Then xx(r, c).val(rr, rc) = CByte(x)
t = CInt(10 ^ j)
d = x \ t : x = x Mod t
xx(r, c).yy(rr, rc, d) = True
Next
End If
i += 1
Next
Next
Next
Next
filRead.Close()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveButton.Click
Dim lout(8) As String, filsave As Streamwriter, i, x, t, d As Integer
Dim saveFile As New SaveFileDialog()
saveFile.Filter = "txt.Files(*.txt)|*.txt"
If saveFile.ShowDialog() = DialogResult.OK Then
MessageBox.Show(saveFile.FileName)
End If
filsave = New StreamReader(saveFile.FileName)
For r As Integer = 1 To 3
For rr As Integer = 1 To 3
lout = filsave.
For c As Integer = 1 To 3
For rc As Integer = 1 To 3
If lout(i) <> "00" Then
x = Integer.Parse(lout(i))
If x > 0 Then xx(r, c).rec(rr, rc).ForeColor = Color.Red
x = Abs(x)
xx(r, c).rec(rr, rc).Text = x.ToString
For j As Integer = CInt(Int(Log10(x))) To 0 Step -1
If j = 0 Then xx(r, c).val(rr, rc) = CByte(x)
t = CInt(10 ^ j)
d = x \ t : x = x Mod t
xx(r, c).yy(rr, rc, d) = True
Next
End If
i += 1
Next
Next
Next
Next
saveFile.InitialDirectory = ""
filsave.Close()
End Sub
End Class
modified on Wednesday, September 16, 2009 10:08 PM
|
|
|
|
|
Loop the array, and write them to a file using a StreamWriter [^]
I are Troll
|
|
|
|
|
I have Idea how to look for next number but I need some help to put into vb 2008 code I am new to vb so please help me
Findnext(fromcell, fromvalue):boolean
• Result=false;
• Insert Fromvalue into Fromcell
• If Fromvalue is the last point (NxN) then set result=true and exit.
• Fromvalue not the last point:
o Set Nextvalue=Fromvalue+1,
o For each of the 4 directions check the neighbor (Nextcell)
Is Nextcell empty and Nextvalue not predefined?
Yes: Result=Findnext(.Nextpoint, Nextvalue)
No: If Nextcell already contains Nextval then this is a predefined number,
Result=Findnext(Nextcell,Nextval);
o end neighbor search loop
• if Result=False and Fromvalue was not predefined then set Fromcell abck to empty
Can please some one help me
Thank you
|
|
|
|
|
Help you with what? It looks like you've got all the logic worked out already, so I don't know what you need help with.
|
|
|
|
|
Hi all,
I want to get the files with different extensions in a directory.
I have written code, which searches the .pdf files and it does what is expected.
modified 28-Nov-12 7:57am.
|
|
|
|
|
You'd have to use three different GetFiles calls and add them to a List(Of). GetFiles doesn't take an argument that lets you specify multiple filespecs in a single call.
|
|
|
|
|
One easy solution is to call the GetFiles() for all of your extensions. The code cuold be something like:
Dim theFilesPDF As FileInfo() = theDir.GetFiles("*.pdf")
Dim theFilesTIF As FileInfo() = theDir.GetFiles("*.tif")
Dim theFilesDOC As FileInfo() = theDir.GetFiles("*.doc")
Dim theFilesXLS As FileInfo() = theDir.GetFiles("*.xls")
As a result you have 4 FileInfo arrays - 1 for each extension.
Regards
Nuri Ismail
modified on Wednesday, September 16, 2009 10:01 AM
|
|
|
|
|
Hi,
there are many ways to do this, I'll give you four of them.
1. The easiest one is also the most expensive: simply get all the files, not just PDF files, into your "theFiles" array, then filter them yourself inside the for loop using a composite IF statement (if pdf or tif or ... then ...). The drawback is it may take a lot of memory storing things you don't really want.
2. the next best thing would be to get four arrays theFiles0...theFiles3 and then either concatenate them, or organize an outer for loop that uses them one by one. This only stores filenames you are going to use.
3. then you could create your arrays one by one, as you are needing only one of them at a time. That would take an outer for loop like
Dim extensions as string()=new string(4)
... insert four extensions in array, then
For each extension as string in extensions
Dim theFiles As FileInfo() = theDir.GetFiles(extensions(extensionNumber))
...inner for loop
Next
4. And finally since .NET 3.5 there are new methods that improve upon Directory.GetFiles() by returning the next file, one by one, without requiring any array at all.
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Thanks to all who spent time to help.
I found your solutions very informative and useful.
Now I have solved the questions with the answers got from you all.
Thanks once again.
Continue the good job of helping others.
|
|
|
|
|
|
With regards to vaiable naming its really a matter of personal style, and just as long it's easy to follow and consistent then the choice is yours. If you're after ideas then what I do is prefix all my variables with a 3 letter abbreviation. For example, String variables I prefix with 'str', booleans with 'bln', etc.
But as for layout and format, if you're using Visual Studion then that should take care of it for you.
|
|
|
|
|
Well, you see, I kept mixing styles where I named every control starting with a 3char prefix, with a style where everything had that prefix (e.g. variable in code too), with other styles for classes. And by layouts, I can't explain exactly what I mean but...
Can anyone point me to some examples of beautifully formatted VB.Net code?
|
|
|
|
|
As a hundred people, and you'll get a hundred different answers... There's no RIGHT answer, really...
My personal style has spontaneously evolved to something like:
Private/method variables: Camel case, no prefix (Since you can mouseover to get the type - If it's confusing, would be using extra comments anyway)
Properties/Methods/Classes: Pascal case... Methods are verbs, classes and properties are nouns (Except boolean properties, which are named like IsBold, CanCalculate, etc - Kinda like that convention as used in WPF)
Iterator variables: I tend to use short names like "idx", "row", "col", "rec"... But I avoid single-letter names unless it's x/y/z for a coordinate system. If I end up using more than one or two at a time, I tend to give them longer names to keep it readable.
As for braces, well, you're using VB, so you don't have to deal with the curly brace debate.
|
|
|
|
|
The convention for naming methods etc would give my code more structure. Thanks for your advice. I tend to use x for local vars, a habit which really is nasty...
|
|
|
|
|
Hi one thing I've found really useful is to not use words such as Date, Time, etc the VB uses, can muck up your code big time, as I've found out. Apart from that use variables that you will understand when looking at code 6mths down the line. I agree with alot that I use things like strBookings if a string for example. Good luck x
Kris MCP
|
|
|
|
|
I would NOT prefix variables with a couple of letters that indicate the type, since that makes type changes hard. You may start with an array of something, later turn it into a list, and afterwards decide to go for a dictionary. You then would have to rename the variables all the time.
I do recommend using meaningful names, using full english words (except for very local variables), and using singular and plural as applicable, so I would write:
For Each stu as Student in students
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
|
I was able to receive, sent email from vb.net application on POP3 mail server, so how can I delete, view sent items and other email functionality using vb.net.
Thank you.
Thayhor
|
|
|
|
|
|
Thanks for your quick response. I have come acrosss the Chilkat mailMan, what I need is how I can achieve this without a third party license class. Can I get a free dll or class that can do that. What I really what is how to implement something like MS Outlook using Vb.net.
|
|
|
|
|
MS Outlook uses a database to store all mail items. You will have to research how to store a mail item to a database.
My advice is free, and you may get what you paid for.
|
|
|
|
|
hi all,
i have a doubt about the DST. I want to ask whether DST is related to State or Country?
Please guide me or provide some helpful link
|
|
|
|
|