|
what txtserial supposed to be? Is user supposed to enter some serial number?
And I see you are trying to compare that value and opening the Form2.
Now I really don't get this statement.
offroaderdan wrote: I have an if statement where i would like to link a serail code e.g b3c to a text documenbt e.g serial.text
If you fail to plan, you plan to fail!
Books are as useful to a stupid person as a mirror is useful to a blind person. - Chanakya
|
|
|
|
|
yeh the user enters a a serial number in txtserial and if this is correct then form 2 is shown.
serial.text checks the textserial to see if the number on the text box matches what is in the text document.
Hopefully that explains it a bit better.
|
|
|
|
|
Well, how is it not working? Does it just never show form 2? If that is the case then the serial is never matching the value from the file. Are you sure you are grabbing the value from the file properly? If so, perhaps it's a situation like having an extra space at the end, or the user typing in lower case instead of upper case. Perhaps you need something like this:
txtserial.Text.Trim.ToUpper = strValueFromFile.Trim.ToUpper
|
|
|
|
|
ummmm its just not finding the value from the file.
i could do a simple if statement that would display form2.
if statement =
if txtserial.text = "hi" then
my.forms.form2.text
i really don't know how to check a txt file
All i need is a simple piece of code that consists of checking a text box aggainst a txt file.
txtserial.Text.Trim.ToUpper = strValueFromFile.Trim.ToUpper 'how woulds i use this to link for example a text file for example serail.txt
thanks
|
|
|
|
|
How about something like this:
Dim strFilePath As String = "C:\Serial.txt"
Dim strSerial As String = String.Empty
If System.IO.File.Exists(strFilePath) Then
strSerial = System.IO.File.ReadAllText(strFilePath)
End If
If strSerial <> String.Empty AndAlso txtSerial.Text.Trim.ToUpper = strSerial.Trim.ToUpper Then
My.Forms.Form2.Show()
End If
|
|
|
|
|
do i put this code under a button?? Is this the only code i need?? Will this code read and find a code e.g DC3 if i have 250+ differnet codes
|
|
|
|
|
You can put this code in a button click event, if that is how you want your program to work. It's up to you. This code will read all of the text in a file and compare it to what the user typed into the textbox. I was operating under the assumption that the textfile would only have one serial in it. If you have serveral serials in the text file you'll have to separate the serials and compare each one in the file, searching for a match. And how to do that will depend upon how your text document is setup. I suggest you do some more research on the subject. You could start with some of these[^] articles.
|
|
|
|
|
thankyou Kschuler i am halfway there to getting my program working. It only took my 6 hours of hard work for a few lines of code, and probably another 6 to get the other halof of the program working buthey i learnt alot, so cheers
|
|
|
|
|
I have tried each and evrything but i can't under stand how to get the selected rectangle outside the text searched with the OCR.
If some one can help me....
Sanjeev Jha
|
|
|
|
|
Do what?
Unless you can find a way to phrase your question so that people can understand what the hell you are talking about no one can help you!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I know what MODI is and how it works, but you're question doesn't make any sense what-so-ever.
|
|
|
|
|
Try and explain the question again, but this time without using any technology-related words. Specify what it is that you try to achieve, what you're observing, and what the behaviour is that you're after.
I are Troll
|
|
|
|
|
how to find the coordinates of text marked in blue after the ocr process. And if i want to copy/save the same marked area as image in some other control like picture box then how can we do that.
If i am trying to copy the area marked in blue and exporting it thru MODI.IMiSelectableImage object but its giving error "Object or With block variable not set"
When Selecting the image one red rectagle comes then only it copies the same. So how we can make visible the selection through code.
Because i have tried after selecting it manually its working fine but i want to use the same through code.
Please Help....
Sanj
|
|
|
|
|
Hi i have a program near enough already made in vb.net but want to add a serail key program. I made it last year but don't know some of the techniques in vb.net
here is the code used
Dim xSlash As String
Dim xFileNbr As Integer
Dim xFileName As String
Private Sub Command1_Click()
Dim hole As String
xSlash = IIf(Right$(App.Path, 1) = "\", "", "\")
xFileName = App.Path & xSlash & "cookies.txt"
xNbr = FreeFile + Rnd
Open xFileName For Input As #xNbr
Do Until EOF(xNbr)
Input #xNbr, hole
If Text1.Text = hole Then
Startnot.Value = vbUnchecked
Form3.Visible = True
Me.Visible = False
Else
Label1.Caption = ("Wrong CD Key")
'B36-678-A863-7CG8F'
-
End If
Loop
Close
End Sub
Private Sub Form_Load()
xSlash = IIf(Right$(App.Path, 1) = "\", "", "\")
xFileName = App.Path & xSlash & "cookies.txt"
SetAttr xFileName, vbHidden
Dim Dontshow As Long
Dontshow = GetSetting(App.EXEName, "Options", "Dont Show Me", 1)
If Dontshow = 1 Then
Unload Me
Form3.Show
Exit Sub
End If
Startnot.Value = vbChecked
End Sub
Private Sub Startnot_Click()
SaveSetting App.EXEName, "Options", "Dont Show Me", Startnot.Value
End Sub
Public Function backup()
Dim XfileW As String
xSlash = IIf(Right$(App.Path, 1) = "\", "", "\")
XfileW = App.Path & xSlash & "checkme.txt"
xNbr = FreeFile
Open XfileW For Output As #xNbr
If Text1.Text = hole Then
Print #xNbr, "1"
Close #xNo
End Function
if anybody could translate it, that would be very helpful as i have laoready pulled out a lot of hair!!!
Many thanks
Dan
|
|
|
|
|
first indent your code and repost it
JustAStupidGurl
|
|
|
|
|
There is nothing overly complicated with your original code. I would strongly suggest you spend the time converting it to vb.net yourself, which will help with the vb.net learning curve.
Remember Google is YOUR friend.
You will need to use the System.IO.File namespace and some of the methods of String for example AStringVar.Length and AStringVar.SubString
If you get really stuck, you can ask us help, but NOT to rewrite the whole code for you.
Gook luck.
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
Thanks Steve for the reply. Umm i haven't really used System.Io.file as well as the other two. Can you explain how to use them in relation to my code???
And the reason for posting the cdoe is that people usually ask to see the code.
|
|
|
|
|
Posting the code was the right thing to do. Failing to put it inside 'pre' tags, so that the formatting and colourization were retained, was where you upset people. Honestly, it is so difficult to read unformatted code that I usually just skip over those posts, which might be a good thing.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hear hear.
except for the usually
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
|
Please do not post the same question in multiple forums, read the guidelines[^].
|
|
|
|
|
Hi there,
I'm a complete nube to this but I need a piece of code that will do the following:
Look inside a large XML file and remove all the entries of
Folder fullpath= (in this case Y:\HQ\)
SizeData Size= (in this case 172204891364)
Put them somewhere (bearing in mind that an Excel doc is limited to 52000 ish rows) and in a form that I can compare this iteration of the XML data to a previous one to allow a comparison of each "SizeData Size=" and "Folder fullpath=" to get growth statistics for each folder
The XML data is in the form below; there is one for each folder and there are 10's of thousands of them.
<Folder fullpath="Y:\HQ\" IsFilesNode="0">
<Name>HQ</Name>
<Attributes>16</Attributes>
<LastAccessDate Low="1344632870" High="30030880"/>
<LastChangeDate Low="4221838626" High="30030879"/>
<CreationDate Low="4129018994" High="29882626"/>
<SizeData Size="172204891364" Allocated="173345047862" Wasted="1138287388" CDRom="172711966720" Files="443755" Folders="42448" Compression="1"/>
<FilesSizeData Size="0" Allocated="0" Wasted="0" CDRom="0" Files="0" Folders="3" Compression="1"/>
I will be able to get the comparison stuff sorted out, but my issue is getting the data out of the XML file in a form that I can manipulate.
Any help gratefully revieved..
|
|
|
|
|
nhsal69 wrote: I'm a complete nube to this but I need a piece of code that will do the following:
0) don't just ask for code, nobody is going to just give you this.
1) Look into the system.xml namespace
some things to get you started:
system.xml.xmldocument
system.xml.xmlelement
nhsal69 wrote: Put them somewhere (bearing in mind that an Excel doc is limited to 52000 ish rows)
2) Why even consider Excel? if this is data (the comparison) doesn't need to be saved then just put them in memory (Datatable or something like it)
If it does need to be saved, at the very least go to Access, SQL server would be better.
nhsal69 wrote: The XML data is in the form below; there is one for each folder and there are 10's of thousands of them.
3) That's a lot of files, take into account that this will most likely take very long to process all of them.
|
|
|
|
|
[quote]
0) don't just ask for code, nobody is going to just give you this.
[/quote]
fair point...
Have been looking at XML File Parsing in VB.NET[^] and been getting more and more confused, can get the example to work, but can't modify it to get it to read the elements I'm after from the example above...
Getting both fields written into a table in SQL, would be ideal..
Will look at your suggestions, ta...
|
|
|
|
|
Your XML file isn't build as neatly as could be still it's doable.
Where are you stuck?
a bit more to get you going (assuming you posted the exact and full XML):
You read the XML in with 'xmldocument.load(path)'
Your first element = 'Folder'
This element has 2 attributes: 'fullpath' and 'IsFilesNode'
Your second element = 'Name'
This element has NONE attributes so you'll have to read the 'InnerText' of the element to get your data
...
This (together with the article) should be enough to find your answer
Also note that when reading these element / attributes XML is case-sensitive (from what I can remember)
|
|
|
|