|
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
|
|
|
|
|
Dim sqlConn as new sqlClient.Connection(your connection string here)
Dim sqlCmd as new sqlClient.sqlCommand()
sqlCmd.Connection = sqlConn
sqlCmd.CommandType = CommandType.StoredProcedure
sqlCmd.CommandText = "your stored procedure name here"
Dim spParameter As New SqlClient.SqlParameter()
With spParameter
.ParameterName = "your parameter name e.g. @CompanyId"
.Size = Size
.SqlDbType = e.g. NVarChar (SqlDbType)
.Direction = e.g. Input (System.Data.ParameterDirection)
.IsNullable = True/False
.Value = Your input value
End With
sqlCmd..Parameters.Add(spParameter)
sqlCmd.Execute
to retrieve return values :
sqlCmd.UpdatedRowSource = UpdateRowSource.OutputParameters
Dim myCompanyId = sqlCmd.Parameters.Item("CompanyId").Value
Steve Jowett
|
|
|
|
|
This[^] should get you started...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
hello every body. can you tell me a hyperlink that show more detail about textbox's event.
|
|
|
|
|
|
how the function replace work.
for example the statement below...
strSource = Replace(strSource, """", "|")
angela
|
|
|
|
|
It creates a new string where the strings are replaced.
Example:
strSource = "asdf"<br />
strDest = Replace(strSource "sd", "-")
Now strDest contains "a-f"
---
b { font-weight: normal; }
|
|
|
|
|
ok, thanks al lot
angela
|
|
|
|
|
I need to read user and organization data from Active Directory , and then insert the data into SQL Server.
Is there any sample code or web site for me?
Thanks a lot!!
|
|
|
|
|
search for "LDAP", also at the ms knowledge base
|
|
|
|
|
I have a small VB 2005 app that opens an instance of PowerPoint, opens a presentation, selects a slide (Variable sld as Slide) and then does a sld.copy() to put a copy of the slide on the clipboard. I know the clipboard has the slide, I can use Paint to see it. What I want to do get the bitmap off of the clipboard and into a PictureBox control, but I have had NO luck. I've found many ideas from MSDN, etc. but none seem to work. Why is this difficult to do? Help would be appreciated.
Some code I've tried to confirm there is an image... along with usng Paint to open the image that I copied using the sld.Copy() program code...
Dim myDataObject As New DataObject(DataFormats.Bitmap, My.Computer.Clipboard.GetImage)
Dim arrayOfFormats As String() = myDataObject.GetFormats()
TextBox1.Text = "The format(s) associated with the data are: " & ControlChars.Cr
Dim i As Integer
For i = 0 To arrayOfFormats.Length - 1
TextBox1.Text += arrayOfFormats(i) & Chr(12) & Chr(10)
Next i
The above code returns:
The format(s) associated with the data are:
System.Drawing.Bitmap
Bitmap
Which implies that the data is able to be interpretted somehow...
And I can also use...
Dim bool As Boolean
bool = myDataObject.ContainsImage
Returns TRUE... So there is an image...
bool = myDataObject.GetDataPresent("System.Drawing.Bitmap")
Returns TRUE... So there is an image...
But all kinds of code DOES NOT result in an image either as various objects or one that I can use in my PictureBox.
Thanks in advance. I hope I can help someone here too, but I am a novice bascially.
|
|
|
|
|
MarchJ,
Items from PowerPoint are placed on the clipboard as an "Enhanced" Metafile Format Image, not a bitmap. You can open them in paint because it can automaticaly open an enhanced metafile (one of the reasons paint is still around).
The only way I know to retrieve the enhanced metafile from the clipboard is to still use the windows API clipboard functions.
This should work in VB2003, and VB2005.
'--- Class --------------------------------------------------
Imports System.Runtime.InteropServices
Public Class ClipboardAPI
<DllImport("user32.dll", EntryPoint:="OpenClipboard", _
SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function OpenClipboard(ByVal hWnd As IntPtr) As Boolean
End Function
<DllImport("user32.dll", EntryPoint:="EmptyClipboard", _
SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function EmptyClipboard() As Boolean
End Function
<DllImport("user32.dll", EntryPoint:="SetClipboardData", _
SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function SetClipboardData(ByVal uFormat As Integer, ByVal hWnd As IntPtr) As IntPtr
End Function
<DllImport("user32.dll", EntryPoint:="CloseClipboard", _
SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function CloseClipboard() As Boolean
End Function
<DllImport("user32.dll", EntryPoint:="GetClipboardData", _
SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function GetClipboardData(ByVal uFormat As Integer) As IntPtr
End Function
<DllImport("user32.dll", EntryPoint:="IsClipboardFormatAvailable", _
SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function IsClipboardFormatAvailable(ByVal uFormat As Integer) As Short
End Function
End Class
'--------------------------------------------------------
'------- Form code --------------------------------------
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Const CF_ENHMETAFILE As Integer = 14
Dim hEnMetaFile As IntPtr
Dim metafile As System.Drawing.Imaging.Metafile
If ClipboardAPI.OpenClipboard(Me.Handle) Then
If ClipboardAPI.IsClipboardFormatAvailable(CF_ENHMETAFILE) <> 0 Then
henmetafile = ClipboardAPI.GetClipboardData(CF_ENHMETAFILE)
metafile = New System.Drawing.Imaging.Metafile(hEnMetaFile, True)
ClipboardAPI.CloseClipboard()
PictureBox1.Image = metafile
End If
End If
End Sub
'----------------------------------------------------------------------
Hope that helps.
progload
|
|
|
|
|