|
wow I feel pretty damn stupid,
thanks for your help
|
|
|
|
|
HOw can i print preview of print my text file in vb.net?
Thanks
................
|
|
|
|
|
More info-- are you trying to open a text file then print it out to a printer. If so
you could just print it to a text box and use the printpreviewdialog control.
depending on the file size you may want to use a stream reader to populate a listbox line by line. Then print each line to the the print document.
|
|
|
|
|
Can u give me an example?
Thanks
................
|
|
|
|
|
'first read the file line by line into an array using a file reader------
Dim fs As New FileStream(path, FileMode.Open)
Dim MyFS As New StreamReader(fs)
Dim Lin As Object
Dim I as integer
Dim strTest as string(50)
Lin = MyFS.ReadLine()
While Not Lin = Nothing
strTEST(I) = Lin
Lin = MyFS.ReadLine()
I +=1
End While
"This is kind of rough but you should have an array of up to 50 lines of text
'put this into a button click event-------------------------------
Dim pd As PrintDocument = New PrintDocument 'Assumes the default printer
AddHandler pd.PrintPage, AddressOf Me.pd_PrintPage
PrintPreviewDialog1.Document = pd
PrintPreviewDialog1.ShowDialog()
'---------------------------------------------------------
Private Sub pd_PrintPage(ByVal sender As Object, ByVal ev As System.Drawing.Printing.PrintPageEventArgs)
Dim vbFont As New System.Drawing.Font("Times New Roman", 9)
Dim q,n as integer
for q = 0 to 50
ev.Graphics.DrawString(strTest, vbFont, New SolidBrush(ForeColor), 0, n)
n += 20
end sub
'any way this is the general idea
'I didn't test the code, but this should get you started
|
|
|
|
|
Thank for your answer, by the way can you help me, how can i change title when jajascript is alert in WebBrowser Control.?
................
|
|
|
|
|
Hi
Can anybody help me out for , is it possible to send an email through an vb.net desktop application.
Is there any way .
|
|
|
|
|
yes you can !!
Imports System.Web.Mail in your code
then use the MailMessage Class
Tamimi - Code
|
|
|
|
|
Tamimi you code is use for web application not in window application.
................
|
|
|
|
|
sorry
i know only this way
Tamimi - Code
|
|
|
|
|
The System.Web.xxxx namespace can be used in either type of application.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Actually, I believe that code will work in a WinForms application as well. I suggest downloading the '101 Visual Basic and C# Code Samples' and taking a look at the one titled 'How-To Send Mail'.
Scott
|
|
|
|
|
Imports System.Web.Mail
Private Sub e_mail()
'Create an instance of the MailMessage class
Dim mm As New MailMessage
mm.To = "bill@fun.com"
End Select
mm.From = "jhoga@salisburync.gov"
mm.Priority = MailPriority.High
mm.Subject = "Change made to receipt number: " & strSN
mm.Body = "Receipt Number: "
SmtpMail.SmtpServer = "mailserver"
SmtpMail.Send(mm)
End Sub
* note "mailserver' is name of a mailserver in my network
|
|
|
|
|
Thanks but i wanted to know that is it possible to send mail through a windowsapplication written in vb.net.
If possible please suggest.
|
|
|
|
|
Do you want to know how to send emails via vb.net 2003 or 2005?
Steve Jowett
|
|
|
|
|
Hi all !
I wanto merge Cell from Cell (8,10) to Cell (8,150). In that, 8 is row index, 10 and 105 is column index. Pls, tell me How can I do to resolve this problem !
Thank alot !
|
|
|
|
|
Can anyone help me, I want to make application that can convert from HTML to XML or ASP to ASP.NET or C# to VB.NET
Thanks
................
|
|
|
|
|
Hi
My problem is this. I have a database in MS Access. The database has 1 query recordset with 6 fields. How can I change the criteria of a field from VB. I use the database in vb to in a flexgrid and i want to change the criteria and the flexgrid show me the resault.
Thanks for your time.
|
|
|
|
|
i have created one .ini file for copy the file from web then backup it in one folder that automatically created by default date.
the .ini file code is like this:-
[source]=http://abc.com
[locadir]=\\the folder i want to place the file
[filename]=name of the file i want to copy from web.
how should i declare the variables and how to auto generates the folder with the date.For the information i'm using vb.net.
Cute Gurlz
|
|
|
|
|
Try this class...
Public Class IniFile<br />
' API functions<br />
Private Declare Ansi Function GetPrivateProfileString _<br />
Lib "kernel32.dll" Alias "GetPrivateProfileStringA" _<br />
(ByVal lpApplicationName As String, _<br />
ByVal lpKeyName As String, ByVal lpDefault As String, _<br />
ByVal lpReturnedString As System.Text.StringBuilder, _<br />
ByVal nSize As Integer, ByVal lpFileName As String) _<br />
As Integer<br />
Private Declare Ansi Function WritePrivateProfileString _<br />
Lib "kernel32.dll" Alias "WritePrivateProfileStringA" _<br />
(ByVal lpApplicationName As String, _<br />
ByVal lpKeyName As String, ByVal lpString As String, _<br />
ByVal lpFileName As String) As Integer<br />
Private Declare Ansi Function GetPrivateProfileInt _<br />
Lib "kernel32.dll" Alias "GetPrivateProfileIntA" _<br />
(ByVal lpApplicationName As String, _<br />
ByVal lpKeyName As String, ByVal nDefault As Integer, _<br />
ByVal lpFileName As String) As Integer<br />
Private Declare Ansi Function FlushPrivateProfileString _<br />
Lib "kernel32.dll" Alias "WritePrivateProfileStringA" _<br />
(ByVal lpApplicationName As Integer, _<br />
ByVal lpKeyName As Integer, ByVal lpString As Integer, _<br />
ByVal lpFileName As String) As Integer<br />
<br />
Dim strFilename As String<br />
<br />
' Constructor, accepting a filename<br />
Public Sub New(ByVal Filename As String)<br />
strFilename = Filename<br />
End Sub<br />
<br />
' Read-only filename property<br />
ReadOnly Property FileName() As String<br />
Get<br />
Return strFilename<br />
End Get<br />
End Property<br />
<br />
Public Function GetString(ByVal Section As String, _<br />
ByVal Key As String, ByVal [Default] As String) As String<br />
' Returns a string from your INI file<br />
Dim intCharCount As Integer<br />
Dim objResult As New System.Text.StringBuilder(256)<br />
intCharCount = GetPrivateProfileString(Section, Key, _<br />
[Default], objResult, objResult.Capacity, strFilename)<br />
If intCharCount > 0 Then GetString = _<br />
Left(objResult.ToString, intCharCount)<br />
End Function<br />
<br />
Public Function GetInteger(ByVal Section As String, _<br />
ByVal Key As String, ByVal [Default] As Integer) As Integer<br />
' Returns an integer from your INI file<br />
Return GetPrivateProfileInt(Section, Key, _<br />
[Default], strFilename)<br />
End Function<br />
<br />
Public Function GetBoolean(ByVal Section As String, _<br />
ByVal Key As String, ByVal [Default] As Boolean) As Boolean<br />
' Returns a boolean from your INI file<br />
Return (GetPrivateProfileInt(Section, Key, _<br />
CInt([Default]), strFilename) = 1)<br />
End Function<br />
<br />
Public Sub WriteString(ByVal Section As String, _<br />
ByVal Key As String, ByVal Value As String)<br />
' Writes a string to your INI file<br />
WritePrivateProfileString(Section, Key, Value, strFilename)<br />
Flush()<br />
End Sub<br />
<br />
Public Sub WriteInteger(ByVal Section As String, _<br />
ByVal Key As String, ByVal Value As Integer)<br />
' Writes an integer to your INI file<br />
WriteString(Section, Key, CStr(Value))<br />
Flush()<br />
End Sub<br />
<br />
Public Sub WriteBoolean(ByVal Section As String, _<br />
ByVal Key As String, ByVal Value As Boolean)<br />
' Writes a boolean to your INI file<br />
WriteString(Section, Key, CStr(CInt(Value)))<br />
Flush()<br />
End Sub<br />
<br />
Private Sub Flush()<br />
' Stores all the cached changes to your INI file<br />
FlushPrivateProfileString(0, 0, 0, strFilename)<br />
End Sub<br />
<br />
End Class
You would then use it like so...
Dim objIniFile As New IniFile("c:\data.ini")<br />
objIniFile.WriteString("Settings", "ClockTime", "12:59")<br />
Dim strData As String = _<br />
objIniFile.GetString("Settings", "ClockTime", "(none)")
Hope this helps
Steve Jowett
|
|
|
|
|
I want to print one Image (placed in image box) on my form I want to start the printing at (0,0) i.e uppermost left corner of the paper ,but when printing some space is left from the top of the paper.How to set the top and left margins of the form while printing (border style is set to none)
Thanks
|
|
|
|
|
I meet a problem while reading a text file,if the file content null characters (hex 00),the read line function can't read whole line infomation.
So anyone has solution about this problem?Thanks,
|
|
|
|
|
hi ,
how do i convert VB 6.0 Data Reports to VB.net Crsytal Reports.
By
BMAX
|
|
|
|
|
Dir sir
I used to ask you above how to execute package from vb.net interface, but i'm not clear above the solution.
I created a package for export data in SQL server 2000 by wizard,but i want to create a stored procedure for executing this package.
So you can tell me about how to create a stored procedure.
Thank you in advance
Best regard
saravuth
|
|
|
|
|
Dir sir
I created a stored procedure that consist of parameter field in SQL server 2000 and I want to execute it from vb.net interface,but i don't know how to assign parameter value.
Can you tell me about solutions in the above topic ?
Thank you in advance.
Best regard,
saravuth
|
|
|
|