|
Chintu Shah wrote: But that links example not work on VB.Net 2005.
Maybe not, but if you have any idea about VB.NET it should be easy enough to convert
There are loads of examples both here on CP and on Google, just use a little initiative.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
The page is called "Visual Basic .NET Code Sample: Send Mail." Is there something I'm missing?
|
|
|
|
|
|
I wrote an article on how to use google here on CP. Sending email is both so trivial, and so widely documented, and yet a quesiton asked here so often, that I used it as an example, you should check it out.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Hi I hope this helps you out...here you are sending mail through exchange server.
This is is vb.net 2005
Public Sub psSendMail(ByVal sSubject As String, ByVal sBody As String)
Try
Dim EmailFrom As String = "SourceServer@Somewhere.com"
Dim EmailTo As String = "YourEmail@yahoo.com"
you can use either of these methods to connect to exchange server
'Dim EmailServer As New System.Net.Mail.SmtpClient("192.0.0.1")
Dim EmailServer As New System.Net.Mail.SmtpClient("emailservername.com")
Dim myMessage As New System.Net.Mail.MailMessage(EmailFrom, EmailTo, sSubject, sBody)
Try
EmailServer.Send(myMessage)
Catch
Finally
myMessage = Nothing
End Try
Catch ex As Exception
End Try
End Sub
|
|
|
|
|
hi friends,
I have made login form.After login when i logout then again Re-login that time without filling username and password show main form during clik on login button.
i want that when i logout then login form show with blank text boxes and when click on login button with blank textboxes gave message(fill text boxes)
Plz sort it out.
I am using following coding:
Code:
Try
conn.Open()
cmd = New SqlCommand("select * from usrs where uname = @user and upwd = @pwd", conn)
cmd.Parameters.AddWithValue("@user", Trim(TextBox1.Text))
cmd.Parameters.AddWithValue("@pwd", Trim(TextBox2.Text))
dr = cmd.ExecuteReader
While dr.Read()
a = dr.Item("upwd")
b = dr.Item("uname")
If TextBox1.Text = a And TextBox1.Text = b Then
sid = dr.Item("uid")
ProgressBar1.Visible = True
'Button1.Visible = False
'Button2.Visible = False
valid = True
Me.TextBox1.Clear()
Me.TextBox2.Clear()
End If
End While
dr.Close()
Catch ex As Exception
MsgBox(ex.Message)
Finally
conn.Close()
cmd = Nothing
End Try
modified on Wednesday, September 10, 2008 8:51 AM
|
|
|
|
|
I don't think there's any reason for If TextBox1.Text = a And TextBox1.Text = b Then . Of course they're going to be equal because that's what the query was to start with. (I assume you meant to say And TextBox2.Text = b instead of TextBox1 twice.)
If the username and password are shown in the textboxes when the form loads, clear the textboxes in Form_Load() .
|
|
|
|
|
Nothing happen:
Try
sUNAME = Trim(TextBox1.Text)
sPass = Trim(TextBox2.Text)
conn.Open()
cmd = New SqlCommand("select * from usrs where uname = @user and upwd = @pwd", conn)
cmd.Parameters.AddWithValue("@user", Trim(TextBox1.Text))
cmd.Parameters.AddWithValue("@pwd", Trim(TextBox2.Text))
dr = cmd.ExecuteReader
If dr.HasRows = 0 Then
MsgBox("Invalid User or Password, Try Again", vbCritical, "Login Error")
TextBox2.Clear()
TextBox1.SelectionStart = 0
TextBox1.SelectionLength = Len(TextBox1.Text)
TextBox1.Focus()
Exit Sub
Else
While dr.Read()
a = dr.Item("uname")
b = dr.Item("upwd")
If sUNAME = a And sPass = b Then
sid = dr.Item("uid")
ProgressBar1.Visible = True
valid = True
End If
End While
End If
dr.Close()
Catch ex As Exception
MsgBox(ex.Message)
Finally
conn.Close()
cmd = Nothing
End Try
form closing event:
sUNAME = String.Empty
sPass = String.Empty
|
|
|
|
|
Hi Frnds..
I need to convet byte array into string and send the text to SMTP Server for sending mails..
Thnks in advance...
Regards Pushpa...
|
|
|
|
|
Dim s As String = System.Text.Encoding.Default.GetString(bytearray)
|
|
|
|
|
In my project I have 3 datatables with different data inside. I have datatables like:
Customers:
Customer number | Name | ID | 123450 | Customer A | 169 | 987650 | Customer B | 753 |
orders in last week:
and orders in sekond week in past:
Now I want to combine these tables data to table like next:
Customer number | Name | ID | 1 week
| 2 week
| 123450 | Customer A
| 169 | 7 | 9 | 987650 | Customer B
| 753 | 3 | 2 |
I know this can be done with datarelation or with SQL inner join but idont have any datasource in my project becose I parse these datas from csv-file to in-memory datatables and dataset.
So how can i do this 4th table in my project?
Thanks in advance
TEH
|
|
|
|
|
_teh_ wrote: I parse these datas from csv-file to in-memory datatables
What makes you think you cannot create a datarelation for a dataset (a dataset is always an "in memory" construct).
You will need to move the 3 tables to the 1 dataset and then create the realtions but this is easy using dataset.tables.add
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
So this can be done with datarelations.
I have not use datarelations before so could you please tell me how should I create the relation to get same result than with this SQL-code?
SELECT a.customerID, a.Name, a.shop_id, ISNULL(sa.PCS1, 0) AS PCS1, ISNULL(sb.PCS2, 0) AS PCS2
FROM customers AS a
LEFT JOIN Shop1 AS sa ON (a.shop = sa.shop)
LEFT JOIN Shop2 AS sb ON (a.shop = sb.shop)
|
|
|
|
|
Data relations are not the same as joins. Only the inner join is valid in a data relation. RTFM type in datarelation hit F1 for more details.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
Dim Table1 As DataTable
Table1 = New DataTable("Customers")
What would be the other way to write this statement??
Please Suggest
Thank You
Nitin
Nitin Jenwal
|
|
|
|
|
Dim table1 As New DataTable("customer")
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
i have a datagridview with a button column ,
i want to get the information in same row with abutton i clicked
help me plz
|
|
|
|
|
hi..,
see this code .., this may help u
Private Sub DataGridView1_CellMouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles dgOnlineTrains.CellMouseClick
Select Case e.ColumnIndex
Case 0
MsgBox("1 Clicked")
Case 1
MsgBox("2 clicked")
Case 2
MsgBox("3 clicked")
End Select
End Sub
Thanks & Regards
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
Hi,
i have developed one activeX component which will be used in web page.
I want control of that web page so that i can give some values to java script which is in that web page.
my question is : how can i access java script from activeX component which is developed in VB6.
thanks
ravi
|
|
|
|
|
am developing an application using vb.net, i created a user control which used in the another application.
am passing parameters to the user control using public properties from files.
i specified a folder , when a new file is created in the folder. in the timer control code am adding the new user control dynamically if the usercontrol is not exists, if it's already exists am updation the values.
problem is when am updation the one usercontrol. the total usercontrols values are changing (as like reference), but am creating new instants every time.
Here is the code :
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Timer1.Enabled = False
Try
Dim Files As String() = Directory.GetFiles(Application.StartupPath & "\data")
Dim Filename As String
For Each Filename In Files
Dim line As String
Using sr As StreamReader = New StreamReader(Filename)
line = sr.ReadToEnd
End Using
Dim cntrllop As Integer, cntlflg As Boolean = False
For cntrllop = 1 To mycontrolcoll.Count
If (UCase(mycontrolcoll.Item(cntrllop).Name) = UCase(Split(Filename, "\")(Split(Filename, "\").Length - 1))) Then
parse_data(mycontrolcoll.Item(cntrllop), line, Filename)
cntlflg = True
End If
Next
If cntlflg = False Then
SyncLock mycontrolcoll
mycontrolcoll.Add(New UserControl1, UCase(Split(Filename, "\")(Split(Filename, "\").Length - 1)), Nothing, Nothing)
mycontrolcoll.Item(mycontrolcoll.Count).name = UCase(Split(Filename, "\")(Split(Filename, "\").Length - 1))
FlowLayoutPanel1.Controls.Add(mycontrolcoll.Item(mycontrolcoll.Count))
parse_data(mycontrolcoll.Item(mycontrolcoll.Count), line, Filename)
End SyncLock
End If
'My.Computer.FileSystem.DeleteFile(Filename)
Next
Catch ex As Exception
MsgBox(ex.Message)
End Try
Timer1.Enabled = True
End Sub
Private Sub parse_data(ByRef MYcontrol As CAMR_Control.UserControl1, ByVal data As String, ByVal filename As String)
MYcontrol.Name = Mid(Split(data, ",")(0), 2)
MYcontrol.Pow_ctrlstart = True
MYcontrol.Pow_v1 = Split(data, ",")(1)
MYcontrol.Pow_v2 = Split(data, ",")(2)
MYcontrol.Pow_v3 = Split(data, ",")(3)
MYcontrol.Pow_i1 = Split(data, ",")(4)
MYcontrol.Pow_i2 = Split(data, ",")(5)
MYcontrol.Pow_i3 = Split(data, ",")(6)
MYcontrol.Pow_p1 = Split(data, ",")(7)
MYcontrol.Pow_p2 = Split(data, ",")(8)
MYcontrol.Pow_p3 = Split(data, ",")(9)
Dim fileData As FileInfo = My.Computer.FileSystem.GetFileInfo(filename)
MYcontrol.Pow_lastread = Format(fileData.LastWriteTime, "dd-MMM-yyyy HH:mm:ss")
'MYcontrol.Pow_nodenumber = Mid(Split(data, ",")(0), 2) & " ,"
MYcontrol.Pow_nodenumber = MYcontrol.Name & " ,"
MYcontrol.Refresh()
FlowLayoutPanel1.Refresh()
End Sub
Please help me ..,
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
|
hi
i am useing crystal 7 file in vb.net
thru crystal report cantrol i geting hresult exection on logonserver
dim axcr as crystalreportcntrol
With axcr
.ReportFileName = "D:\D.NET\Marfatiya\report\billoutstanding.rpt"
i = .LogOnServer("p2ssql.dll", server01, REP00, userxx, passxx)
.set_ParameterFields(0, "P1 ;" + conmxx + ";TRUE")
.Action = 0
.Destination = Crystal.DestinationConstants.crptToWindow
End With
|
|
|
|
|
Standard Question #1: What's the error message, exactly??
|
|
|
|
|
Hi,
Thank's
i don't know actule error but i getting this error Exception from HRESULT: 0x800A5038
i am getting
|
|
|
|
|
From what little information I can find on the result, it looks like either the .DLL isn't where it should be or the server name can't be resolved. I also found a possible reference to the username/password being bad.
|
|
|
|
|