|
Im trying to print to a 40 column printer through my VB Application. But the printer instead of printing it will keep showing Spooling status. Im Using Epson TM-U220PD Printer, VB 6.0 and Sql Server 2000 as Backend. Anybody plz help me out in this context. I need to solve this urgently...
Here is my code...
sql = "select * from ReportTable"
If rstemp.State = 1 Then rstemp.Close
rstemp.Open sql, con, adOpenStatic, adLockOptimistic
If rstemp.EOF = False Then
'Open "LPT1" For Output As #intFreeFile
Open App.Path & "\reports\Billing.txt" For Output As #1
Printer.Print ""
Printer.FontName = "Arial"
Printer.FontBold = False
Printer.FontSize = 8
Print #1, vbTab & Trim(rstemp!CompanyName)
Print #1, vbTab & Trim(rstemp!BranchName)
Print #1, Space(1) & Trim(rstemp!Address) & Trim(rstemp!Street)
Print #1, vbTab & Trim(rstemp!City) & "," & Trim(rstemp!Phone)
Print #1, Space(1) & "CST No:" & Space(1) & Trim(rstemp!CATName) & Space(2) & "KST No:" & Space(1) & Trim(rstemp!DeptName)
Print #1, Space(1) & "TIN No:" & Space(1) & Trim(rstemp!VATNo)
Print #1, "-------------------------------------"
Print #1, " CASH BILL "
Print #1, "-------------------------------------"
Print #1, "M/s: " & Trim(rstemp!EANCode)
Print #1, "BillNo: " & Trim(rstemp!slno)
Print #1, "Bill Dt: " & Trim(rstemp!a1Date) & Space(3) & "Time: " & Right(Trim(rstemp!a2date), 12)
Print #1, "-------------------------------------"
Print #1, "SN" & Space(1) & "Desc." & vbTab & Space(4) & "Qty" & Space(2) & "Rate" & Space(4) & "Amt"
Print #1, "-------------------------------------"
slno = 1
totitem = 0
totamt = 0
Do Until rstemp.EOF
If Len(rstemp!ItemName) <= 14 Then
Print #1, Space(1) & Trim(slno) & Space(1) & Trim(rstemp!ItemName) & Space(14 - Len(Trim(rstemp!ItemName))) & Space(3) & Trim(rstemp!Qty) & Space(3 - Len(Trim(rstemp!Qty))) & Space(2) & Trim(Format(rstemp!sp, "#0.00")) & Space(6 - Len(Trim(rstemp!sp))) & Space(2) & Trim(Format(rstemp!amount, "#0.00"))
totitem = totitem + Val(rstemp!Qty)
totamt = totamt + Val(rstemp!amount)
Else
str1 = Trim(Left(rstemp!ItemName, 14))
str2 = Trim(Mid(rstemp!ItemName, 15, 40))
Print #1, Space(1) & Trim(slno) & Space(1) & Trim(str1) & Space(14 - Len(Trim(str1))) & Space(3) & Trim(rstemp!Qty) & Space(3 - Len(Trim(rstemp!Qty))) & Space(2) & Trim(Format(rstemp!sp, "#0.00")) & Space(6 - Len(Trim(rstemp!sp))) & Space(2) & Trim(Format(rstemp!amount, "#0.00"))
totitem = totitem + Val(rstemp!Qty)
totamt = totamt + Val(rstemp!amount)
End If
slno = slno + 1
rstemp.MoveNext
Loop
Print #1, "-------------------------------------"
Print #1, " Total : " & Trim(totitem) & Space(3) & Trim(Format(totamt, "#0.00"))
Print #1, "-------------------------------------"
Print #1, "Some text goes here"
Print #1, "Goods once sold will not be exchanged or "
Print #1, "taken back. "
Print #1, "Some text goes here"
Print #1, "Some text goes here"
Print #1, "Some text goes here"
'Ejecting the page
Print #1, Chr$(12);
'Releasing the printer
Print #1, Chr$(27); "q";
Close #1
Else
'Do Nothing
End If
rstemp.Close
|
|
|
|
|
praveenhathwar wrote: I need to solve this urgently...
That's your own problem, then. This site is not for people with urgent needs. Members will post on their own free time, when and if they do feel like it.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Hello everybody,
I have a big issue that I can't seem to be able to solve. I need to find a SINGLE CPU process (one program that I know the name of), and display it into a label.
For example My_program ---> 20%
I use (on a timer)
Private m_PerformanceCounter As New System.Diagnostics.PerformanceCounter("Processor", "% Processor Time", "_Total")
ListBox1.Items.Add(CInt(m_PerformanceCounter.NextValue()) & "%")
but I think I get ALL processes added up. I just want ONE of them
for example (in pseudocode)
if process.name = "My_program" then label1.text=process.CPUUsageTimeOfTHatProcess
How can I do it with VB.NET? Any help will be much appreciated. Thank you in advance.
Still trying to find the way
|
|
|
|
|
Of course it's returning the total CPU usage. Look at the line of code your using:
Chaos Machine wrote: Private m_PerformanceCounter As New System.Diagnostics.PerformanceCounter("Processor", "% Processor Time", "_Total")
On top of this, you don't even need the Performance counters to do this. You can get a processes CPU time using the process' Process object. Checkout the Process class[^] and it's TotalProcessorTime and UserProcessorTime properties.
|
|
|
|
|
Hi All,
I posted this under XML but after reading some of the other posts, it was probably the wrong message board so here it is.
OK I have worked out the below code to return the 'EN' string if I supply the string code, say "1000" of the below XML file but what I need to know is how to search for the string and return the string code. If I could use a wildcard in this it would be great.
Any Thoughts???
Private Sub XPathSearch(ByVal XMLPath As String)
Dim xmlNI As XPathNodeIterator
Dim xpathDoc As XPathDocument
Dim xmlNav As XPathNavigator
Try
xpathDoc = New XPathDocument(XMLPath)
xmlNav = xpathDoc.CreateNavigator()
xmlNI = xmlNav.Select("/MOMLANG/STRING[@code='" & stringValue & "']/LANG[@code='EN']")
While (xmlNI.MoveNext())
'Me.RichTextBox1.AppendText(xmlNI.Current.Name + " : " + xmlNI.Current.Value & vbCrLf)
Me.RichTextBox1.AppendText("String value: " + xmlNI.Current.Value & vbCrLf)
End While
Catch ex As XPathException
System.Console.WriteLine("XMLException: " + ex.Message)
Catch ex As Exception
System.Console.WriteLine("Exception: " + ex.Message)
End Try
End Sub
I have worked with reading simple XML elements but have not worked with atributes and the like. I am also new to both XML and Dev in general.
I have read several articles but most give me examples for reading simple XML e.g.
<person>
<firstname>John</firstname>
<lastname>Smith</lastname>
</person>
The file I am trying to read is below, any help would be great and examples are very much welcome. My goal for the GUI in VB.NET will be to have a textbox to enter string number I am searching for and a dropdown but to select the language.
Regards
Jason
<momlang>
<string code="2000">
<lang code="AR">Access Allowed List</lang>
<lang code="CZ">Access Allowed List</lang>
<lang code="DE">Access Allowed List</lang>
<lang code="DK">Access Allowed List</lang>
<lang code="EE">Access Allowed List</lang>
<lang code="EN">Access Allowed List</lang>
<lang code="ES">Lista de accesos permitidos</lang>
<lang code="FI">Pääsylista sallitut</lang>
<lang code="FR">Liste des accès autorisés</lang>
<lang code="GB">Access Allowed List</lang>
<lang code="HU">Hozzáférés Engedély Lista</lang>
<lang code="IT">Elenco accessi consentiti</lang>
<lang code="NL">Access Allowed List</lang>
<lang code="NO">Liste over systemtilgang</lang>
<lang code="PL">Access Allowed List</lang>
<lang code="RU">Access Allowed List</lang>
<lang code="SE">Använda tillåten lista</lang>
</string>
<string code="10000">
<lang code="AR">المطبوعة:</lang>
<lang code="CZ">Vytisknuto:</lang>
<lang code="DE">Gedruckt:</lang>
<lang code="DK">Printed:</lang>
<lang code="EE">Prinditud:</lang>
<lang code="EN">Printed:</lang>
<lang code="ES">Impreso:</lang>
<lang code="FI">Tulostettu:</lang>
<lang code="FR">Imprimé:</lang>
<lang code="GB">Printed:</lang>
<lang code="HU">Nyomtatott:</lang>
<lang code="IS">Printed:</lang>
<lang code="IT">Stampato:</lang>
<lang code="NL">Afgedrukt:</lang>
<lang code="NO">Skrevet ut</lang>
<lang code="PL">Wydrukowano:</lang>
<lang code="RU">Ðапечатано:</lang>
<lang code="SE">Utskrivet:</lang>
</string>
</momlang>
When people make you see red, be thankful your not colour blind.
|
|
|
|
|
I want to control (get/set) the volume level of master/wave/mic of a soundcard using VB.2008.
Where can I find a sample file or more information.
Me kiter
|
|
|
|
|
|
how can i use the metaphones in VB.NET reply me soon
|
|
|
|
|
|
Hi all!
I'm hoping this is the place to post this, as it's not EXACTLY VB / VB.NET, and there's no Topic for VBScript...
Anyways - To the question.
I'm trying to find a way to input a URL, and have it display the raw HTML Data for it.
Eg: If I input:
http://www.codeproject.com/
It'll output:
<html>
<head>
<title>CodeProject. Free source code and programming help</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Description" content="Free source code and tutorials for Software developers and Architects.">
<meta name="Keywords" content="Free source code, tutorials">
<meta name="Author" content="The Code Project">
</meta></meta></meta></meta></head></html>
etc etc etc.
Does anyone know if this can be done?
It is an ASP Page, using VBScript for Code (Due to limitations, JavaScript cannot be used on the page)
Thanks alot
- Reelix
-= Reelix =-
|
|
|
|
|
|
Works FANTASTICLY!
Thanks alot!!!!
- Reelix
-= Reelix =-
|
|
|
|
|
Ok I have a file that I want to search for an ID number, this number has some data in a string of integers after it. I want to be able to search for the ID number and then record the last number of the string. I'll post some sample data here:
<code>[6661] = "0:3;3;1861999.8;2454571.3;2716464.2;1469749.8",</code>
[12024] = "774:1;1;60000.0;60000.0;60000.0;60000.0",
[7431] = "866:1;1;20000.0;20000.0;20000.0;20000.0",
[12030] = "1191:1;1;33000.0;33000.0;33000.0;33000.0",
[15602] = "336:1;1;28844.0;28844.0;28844.0;28844.0",
[15349] = "769:1;1;70000.0;70000.0;70000.0;70000.0",
The way the integers are read is
The item number for Flurry Axe is 871. The following entry in my Auc-Stat-Simple.lua represents it
[871] = "0:11;14;2805857.8;2670179.1;2780751.9;2991890.6",
To take it one piece at a time:
1) [871] = Item #
2) "0:" = Suffix number
3) "11;" = ???
4) "14;" = ???
5) "2805857.8;" = This correlates with the 3 day average from Stat-Simple, as you can see in the picture of the Tooltip I've attached.
6) "2670179.1;" = This correlates with the 7 day average from Stat-Simple
7) "2780751.9;" = This correlates with the 14 day average from Stat-Simple
8) "2991890.6" = This correlates with the the Average Mimimum BuyOut from Stat-Simple
I want to know how to search for the Item# and then take the last number (8), and then store it. After I have it stored I need to know how to convert that number to a certain format. The format of the number is in an in game currency. The set up would be Gold(g),Silver(s),Copper(c) so number 8 would be formatted as 299g 18s 91c. So we'll look at the first string of data in the code box.
[6661] = "0:3;3;1861999.8;2454571.3;2716464.2;1469749.8",
I want to be able to search for 6661 for the ItemID then get the 8th number in that string which is 1469749.8. I want that number to be converted to this format 146g 97s 50c. My main issue is searching for the ItemID and then I guess I would have to figure out how to split the last number, as well as round the decimal if there is one.
If you want to look at the file that needs to be searched it can be found here http://rapidshare.com/files/144373662/Auc-Stat-Simple.lua.html[^]Virus Scan here for those who want it:http://www.virustotal.com/analisis/49bb2fc360d420da5100356a2603dc12[^] If you want to view the contents of the file, just open it with notepad.
|
|
|
|
|
Well, you could read the file using a StreamReader line-by-line, using StartsWith() to see if the line has the ID you want. If it does, then use Split() on the part of the line contained in quotes, with ; as the delimiter. That will give an array of the values in the line. Then you can get the last item, and parse it accordingly.
|
|
|
|
|
Alright thanks for the suggestions, I had known about the streamreader but not that it had an option to do "StartsWith()" etc. I'll try that out and post back if it works. Thanks again.
|
|
|
|
|
Ok I have it searching the file fine, it reads the line and prints it out how it is supposed to. But now I guess is how to work on my second question. I can split the line fine, the only problem is I'm unsure of how to get the last number in the string or the last thing that has been split. Say we have :
[2449] = "0:37;5277;1201.7;1297.2;1436.9;467.4",
I need to get the last number in the string that is after the last ";" so it would be "467.4". I'm guessing I would need some type of loop but I'm not sure how to count the number of splits it has done. The number I'm looking for will always be after the 5th ";". If I can get that number, the only thing left to do would be to format it. But that can be saved for later.
|
|
|
|
|
Never mind this, I actually figured it out on my own. My last step is to round the last number and format it. I think this would of a different topic from my original question. I have this code and I need to round the number in the array of a string which I don't know if it is possible.
Dim aryTextFile() As String
This is the item I need to round, but it is in array form I believe, and needs to be converted to a decimal to be rounded. I'm not sure how this would be done. I tried making an integer and then assigning the array item to the integer and rounding from there before putting it in the label but this did not work.
What this code does is:
1. Opens the file
2. Reads it line by line till it gets to "[2449] = ""0:"
3. Reads the line that is after "[2449] = ""0:" to get "[2449] = "0:37;5277;1201.7;1297.2;1436.9;467.4","
4. After it gets that string it splits it up 6 times.
5. After the 6th split it gets this string 467.4",
6. It trim the ", off and leaves me with 467.4
7. After 467.4 I need it to be rounded to 467
8. After it is rounded to 467 I need it to be formatted into a certain in game currency. The format goes 100 copper = 1 silver, 100 silver = 1 gold. The number above would be formatted as 4s 67c so its somewhat reversed. Maybe this can be done with simple math.
So far I only need steps 7 and 8
I also want to know if it is in anyway possible to put this code into a function and have data input and returned from it. The information that is in there is hard coded and I don't want to do this for every instance as it would get confusing. I only have it hard coded to test it.
Dim fs As New FileStream("C:\Program Files\World of Warcraft\WTF\Account\<account name="">\SavedVariables\Auc-Stat-Simple.lua", FileMode.Open)
Dim sr As New StreamReader(fs)
Dim intcounter As Integer
Dim line As String = ""
Dim count As Integer
Dim LineOfText As String
Dim i As Integer
Dim aryTextFile() As String
Dim startval As String
Dim chArr() As Char = {"""", ","}
startval = "[2449] = ""0:"
Try
Do
line = sr.ReadLine()
If line IsNot Nothing Then
If line.Contains(startval) Then
intcounter = intcounter + 1
If intcounter = 1 Then
LineOfText = line
aryTextFile = LineOfText.Split(";".ToCharArray)
For i = 0 To UBound(aryTextFile)
count = count + 1
If count = 6 Then
Label11.Text = (aryTextFile(i).Trim(chArr))
count = 0
End If
Next i
'Label11.Text = line
End If
End If
End If
Loop While line IsNot Nothing
Catch a As Exception
Label11.Text = "Not Found"
End Try
sr.Close()</account>
|
|
|
|
|
Ok again with a little tweaking I got that working. So now my main concern is being able to put all this code into a function.
|
|
|
|
|
I wondered if anyone may know, I just want to write a bit of VBA to put in an excel macro so that it a sheet of data, wherever a row contains a 0 in a certain column (e.g. column e), the row will be deleted.
I know it would be a loop but I have never been very good on loops.
So basically, e.g. it would do this
Row(2)- if cell E(2) = 0 delete row, search next row, search until rows are null
thanks
|
|
|
|
|
This [^] site is a good resource for VBA.
I had typed out a detailed response to your query, but lost it when I hit the "Post" button I hope you can find your solution from the site I have pointed you to.
|
|
|
|
|
How to add an icon of my program to Internet Explorer Toolbar and accessing my program from there?
Gagan
|
|
|
|
|
Do you mean the icons on the top bar containing the favorites icon, history icon...etc?
Or do you mean a new toolbar like google toolbar kind of thing?
|
|
|
|
|
Thanx for expressing your interest in my question.
I wan to add my program on IE Toolbar like Google or any other toolbar so that I can access my program from there...
Plzzzzz reply......
|
|
|
|
|
All I know about this is that somewhere in the group policy or somewhere like that there is a option to put custom toolbars there, but I think that only applies to IE6 and the way it works it dosent look like it could be easly done with an application.
Lloyd J. Atkinson
"Logic will get you from A to B, but imagination will take you everywhere" - ALbert Einstein
I look at Microsoft, and turn to my poster on the wall saying: "Bang head here in case of stress".
|
|
|
|
|
Thanks Lloyd Atkinson but I want to put my program on IE Toolbar using vb.net codes not by using gpedit policy.
If you got the solution then reply me.
Thanx.
|
|
|
|
|