I have an application that downloads a .txt file via FTP, and then it calls some sql to insert the file data into my database. I want to check whether the file is in the correct format before trying to insert.
The file should consist of some number of rows, each with the following format:
(4 letter code) (tab) (3 or 4 letter code) (tab) (date as dd-MMM-yy) (tab) (variable length text description) (tab) (1 letter code)
Is there a good way to check whether every line in the file follows this pattern, and warn me if it doesn't?
I just spent about 2 hours searching this forum on this topic but I need some advice. I am looking to extract certain data from HTML source code that I have down loaded into a text file its about 9KB in size.I am looking to keep all email address found. How would this work or what would be the best method to use? This is what I would like to extract and write to another file:
I'm attempting to parse a text file containing several Windows paths; I'd like to use regular expressions if possible, and I'm using VB.NET.The file is formatted somewhat like so:
M - Network Mode C:ClientSystem - System Path C:ClientProducts - Product Path
Currently, I've used System.IO.StreamWriter to write items to a text file. However, what I have are items separated by a Writeline(). Meaning, the items are displayed in several rows, in a column. But what I want is a single row, with many columns, separated by commas for each item. Example of what I want: 16/8/2010,100,you
vb.net Dim psBattery As PowerStatus = SystemInformation.PowerStatus Dim perFull As Single = psBattery.BatteryLifePercent Dim Now As DateTime = DateTime.Now
I'm writing a little web service which generates SO/SF/SU/MSO user flair in the form of an image with various "themes". I find this preferable to using the HTML/JS solutions offered by SO as it's more flexible and also works better in forum signatures.
I'm retrieving the data using the apparently unofficial API (More info here). I can have the data in HTML or JSON. I assumed the JSON would be easier to parse.
Unfortunately, I'm not great at regexes. and the best I can come up with is some very hacky sub-stringing. I believe a regex should be the most elegant solution
regex that matches ID, GravatarURL, ProfileURL, DisplayName, Reputation and Badge Counts (Bronze/Silver/Gold).
FWIW This is to be used in a VB.Net project (in case that affects the syntax at all)
[Code].....
In case any of you are interested, some screenshots of the flair as a work in progress are available here: Me, Jeff Atwood, Joel Spolsky
I want regular expression validator for my telephone field in VB.net. Telephone format should be (+)xx-(0)xxxx-xxxxxx ext xxxx (Optional) example my number would appear as 44-7966-591739 Screen would be formatted to show +44-(0)7966-591739 ext?
I've been asked to create a string slicing programme that will take data from a spreadsheet and output it to a delimited ASCII file. The data in the text file follows the structure as shown below:
The text file has about 7-8 rows off data following the same structure but with a few changes. So I want to remove the semi-colons from each row of data and format the text file so it has the correct columns on the first row and then the data below but with the long, lat removed etc. However I can't just remove all the semi colons as time uses them.[code]...
I am simply trying to do this for knowledge sake. I created a simple code that writes(append) to text file whatever the user enters in a text box and click a button.
I am just wondering if it is possible to format the data in the text file?
Example: Add a space between the data being entered every time?
I have a datagrid and I need to be able to print out its content. I can get the values from the cells, place them into a text file and launch the file. My problem is that my cells just are put into the txt file in a long list and I want to be able to display them in columns with headings. I am using the following
I'm trying to save a text file with a certain format, kind of trying to create some sort of colums, so when I open it will be easier to read...If I have these four words: Calendar, Car, Time, Airplane; I would like to put them into colums...
The problem:When I save it to a text file or print it, it comes out like this:Calendar AirplaneTime CarHow can I put them like "centered", so that doesn't look like that mess...?
Im trying to get some particular content from a site and place it in text file. i have used a listbox for loop of urls i want to process and another to see output of data. now i want all data in text file each item seperated by "~" sysmbol.
Exmaple Link i used in my.txt file: [URL]
Data expected in text file:
Abbeville High School Basketball Stats ~ Team: Varsity 11-12 ~ Colors: Maroon, Gray, White ....
I'm having some trouble using resource files. In my project I'm using a bunch of bitmap files and two txt files. Bitmaps are used as backgrounds for controls, but .txt files I want to open in Notepad or WordPad. Till now I was accesing them from a file path on my machine: ControlName.backgroundimage = New Bitmap(direcorypath & "/Map.bmp") Process.Start(direcorypath & "/Instrukcje.txt")
And it worked fine. Now I added these files to my resources (it's practical for me to have them in executable file) And replaced those lines with: ControlName.backgroundimage = New Bitmap(MyProject.My.Resources.Map) Process.Start(MyProject.My.Resources.Instrukcje)
For bitmap it works fine, but for txt file an error occurs saying that a file cannot be found. Interestin thing is: when I type "MyProject.My.Resources.Instrukcje" in "Watch" it shows the content of the file. So it is there, only not as a file?
I want to get all the words before the tab into one array or to create a new text file and the all the words after the tab into another array or create a new text file too.
Here my function to get the words before tab into an array :
Protected Sub MakeWordListBeforeTab() Dim filename As String = "D:lao�0001.txt" 'read from file'
[Code].....
I wrote the above function to get all words before tab but I got all the words into array. I've been trying to use the Split method above. What is another method to split those words ?
I know this can be done with regular expression but I don't know regex yet. If you can show me how to get this done with regex it'll be awesome.
I'm returning a database query into a List object and using that list object to fill the X and Y axes of my chart as seen below. (_runData is a "List(of DatabaseTableName)" style Object filled with the results of my query.
Primary_Chart.Series(0).Points.DataBindXY(_runData, "DateTime", _runData, "UPPER_PRESSURE") My Datetime field is returning as a Serial Number (i.e. 40116.76111) so I want to format the X Axis to display the field more readably. Enter my problem code.
On the main form of my application, I have a Rich Text Box which is where the user will be entering information. The text is black. then, i have a button which calls the dialogue "Notes" A dialogue appears, with a rich text box. the user should then be able to enter text into the box, click "OK", and the text entered into the Notes dialogue be inserted to the rich text box on the main form -- with the font colour "Red". The rest of the text in the main rich text box on the main form should remain black.
I found C# code for it here. So I tried Public Function checkProperty(ByVal objectt As Object, ByVal propertyy As String) As Boolean Dim type As Type = objectt.GetType Return type.GetMethod(propertyy) End Function
But it throws an error at type.GetMethod(propertyy) saying "Value of type 'System.Reflection.MethodInfo' cannot be converted to 'Boolean'." What to do?
I have listBox control of user objects where each object has userName and Password.What I want to do is when a user enters userName and Password a method goes through the listBox checks for whether userName exists or not and if userName exists then matches the password.What I have in my mind is that to use for each loop but I think it would become complex so is there any better way?
I'm having to code hangman. So far I've done well, except for the part where I need to verify if the five character word contains a number. I also need to verify that the letter they are putting in does not contain a number. I have to use loop, so I'v considered using Do. Anyways, the loop needs to verify one character at a time that one of the character's is not a number. I know I can also use word like "[!a-zA-Z]" and that will verify the word does not have any numbers, correct? I have not assigned any value to letter yet, just word. Basically I've give the word length 5. I also know I need to use subString, but I'm not sure where in the loop.
in VB10 Express is there a way to verify that something in a list box has been selected BEFORE an action can be taken? I was debugging and found an unhandled error when I accidentally told the program to do something, but there was nothing selected.
Okay, I will be using Username &'Type' through out my project to verify certain things. On workbook open, I grab the username. Now I want to put the username list and type into a public array. The username list has a range name of UID and the type has a range name of UIDType. The combined list has a range name UIDCo. Which will be more 'resource' friendly? To load UID into one array and UIDType in another or to load the UIDCo into one all encompassing array? I will very rarely use either list alone, it will almost always be a combination of UID and Type verification.
2nd question is, I've only really used 1 dimensional array's before, any help on where I can research more about multi-dimensional arrays. I can pretty much figure out the what it does and how to use them. I'd be more interested in the actual syntax or coding samples.