Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 24th, 2007, 11:51 AM   #1
randum77
Programmer
 
randum77's Avatar
 
Join Date: Jun 2006
Location: Fayettehell, NC
Posts: 56
Rep Power: 3 randum77 is on a distinguished road
vb.net to VBScript

Is there an easy way to convert from VB.net to VBScript code? I'm just recently started getting some what good w/ VB.net, and i'm not entirely familiar w/ VBScript. Here's what I am doing in VB.net.

Dim strTag As String
        Dim intValue As Integer
        Dim objStreamW As IO.StreamWriter
        Dim tdNow As Date


        'Variable
        strTag = "L3Mas"
        intValue = 1

        'Writes info to file. 
        objStreamW = IO.File.AppendText("text.txt")
        objStreamW.Write(strTag & "|" & tdNow & "|")
        objStreamW.WriteLine(intValue)


        'Closes
        objStreamW.Close()

        Me.Close()

Should I even bother w/ putting that in VBScript. I figured it'd be easier to mass produce in script since i don't have alot of time to get this done.
__________________
_Marshall_

"America has bred a society that is innocent and incapable of accepting responsibility, but yet, is able to place blame on others without guilt."
randum77 is offline   Reply With Quote
Old Apr 24th, 2007, 2:03 PM   #2
melbolt
Hobbyist Programmer
 
melbolt's Avatar
 
Join Date: Feb 2005
Location: PA, USA
Posts: 233
Rep Power: 4 melbolt is on a distinguished road
Send a message via AIM to melbolt Send a message via Yahoo to melbolt
what exactly are you trying to do?
__________________
I have never let my schooling interfere with my education. -Mark Twain-

Xbox live gamertag: melbolt
melbolt is offline   Reply With Quote
Old Apr 25th, 2007, 10:44 AM   #3
randum77
Programmer
 
randum77's Avatar
 
Join Date: Jun 2006
Location: Fayettehell, NC
Posts: 56
Rep Power: 3 randum77 is on a distinguished road
All i am doing is writing a file to a server that looks like

" tagname|date time|value "

and naming the file based on what the tag name is. It's also formatting the date as requested by my boss.

I put the variables in there to make it to make duping it very easy. All this is being done in the load even of form1.
__________________
_Marshall_

"America has bred a society that is innocent and incapable of accepting responsibility, but yet, is able to place blame on others without guilt."
randum77 is offline   Reply With Quote
Old May 1st, 2007, 3:39 PM   #4
randum77
Programmer
 
randum77's Avatar
 
Join Date: Jun 2006
Location: Fayettehell, NC
Posts: 56
Rep Power: 3 randum77 is on a distinguished road
Just wanted to check back in with everyone. I doubt it matters much but I got things figured out. I started digging through the MSDN and here is what I came up with.

Dim fso, MyFile, strFileLoc
Dim currDate, currTime, currMonth, currMonAbr, currDay, currYear

strfileloc = "\\servername\location\testfile1.txt"
currDate = date
currTime = time
currDay = day(currdate)
currYear = year(currdate)
currMonth = Month(now)
currMonAbr = MonthName(currmonth, true)


   Set fso = CreateObject("Scripting.FileSystemObject")

   Set MyFile = fso.CreateTextFile(strFileLoc, True)

   MyFile.WriteLine("TagNameHere" & "|" & currDay & "-" & currMonabr & "-" & currYear & " " & currtime)

   MyFile.Close

I might still have to figure out how to change the time from 12 to 24 hour time. The only way I can figure that is to use the hour, min, and sec function then search the string for AM or PM and add 12 to the hour if necessary. Then finish the write w/ Hour & Min & Sec.

__________________
_Marshall_

"America has bred a society that is innocent and incapable of accepting responsibility, but yet, is able to place blame on others without guilt."
randum77 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
difference VB and VB.net gpreetsingh Visual Basic .NET 10 Feb 18th, 2006 6:18 AM
[Help] Scripting with VB.net Austin123 Visual Basic .NET 3 Feb 17th, 2006 5:44 PM
VBScript and ASP java_roshan ASP 3 Oct 3rd, 2005 1:27 PM
vb6 to vb.net bl00dninja Visual Basic .NET 2 Sep 24th, 2005 1:55 PM
Making a database application in VB.NET emdiesse Visual Basic .NET 3 Sep 18th, 2005 5:58 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 9:45 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC