|
give me a couple minutes I'll see what I can box together
|
|
|
|
|
ok have a small example here's the code (bit much but since I can't attach it no choice)
<code>
Public Class Form1
Private con1 As String
Private con2 As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
con1 = "Server=999.999.999.999;Database=master;user ID=master;Password=master;Trusted_Connection=false"
con2 = "Server=000.000.000.000;Database=master;user ID=master;Password=master;Trusted_Connection=false"
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
clsDA.msConnectie = con1
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
clsDA.msConnectie = con2
End Sub
End Class
Imports System.Data.SqlClient
Public Class clsDA
Public Shared msConnectie As String
Public Shared Function GetDR(ByVal sSQL As String, ByVal ParamArray dbParams() As SqlParameter) As SqlDataReader
Dim oCommand As SqlCommand
Dim oDataReader As SqlDataReader
Dim ocon As SqlConnection
Try
ocon = New SqlConnection(msConnectie)
ocon.Open()
oCommand = ocon.CreateCommand
oCommand.CommandType = CommandType.Text
oCommand.CommandText = sSQL
For Each opar As SqlParameter In dbParams
oCommand.Parameters.Add(opar)
Next
oDataReader = oCommand.ExecuteReader(CommandBehavior.CloseConnection)
Catch ex As SqlException
...
End Try
Return oDataReader
End Function
End Class</code>
hope this helps
|
|
|
|
|
|
Hi,
i like to get my projects startup path in VBA, i.e., how to find the installed folder of an application.
I got the code in VB.NET but my requirement is to get in VBA as macro
My.Application.Info.DirectoryPath.ToString
Thanks,
Nanda
|
|
|
|
|
If you are using VBA, I assume you are using MS Access. This is how to get the path for the current database in Access:
Application.CurrentProject.Path
Hope this helps.
-------------------------------------------
Damian - Insert snappy one-liner here.
|
|
|
|
|
One way of doing it is the next
currentdb.name
this will return the full path with the database name
|
|
|
|
|
am using MS word template, and no databases are used.
pls help me in this.
Thanks,
Nanda
|
|
|
|
|
try this
Dim s As String
s = CurDir
s = CurDir$
s = Application.Path
s = ThisDocument.Path
s = ActiveDocument.Path
I hardly ever use word so I'm not that good at it but these seme to return serveral path's maybe one of them is what you want
|
|
|
|
|
how can i send serial data over the ethernet using the vb.net code?
|
|
|
|
|
What do you mean by "serial data".
You send the data according to the specifications of the server that is listening for it. Without knowing that, or knowing how your going to write the server, sending it is a moot point.
|
|
|
|
|
hello frnds,
how can i send a mil using MSoutlookExpress which is should be view in the reciever Draft folder,
means i want to send a mail over my LAN and my inputs are reciever mail id,message,subject and when i send mail then it should be view in the reciever Draft folder
I am using vb.Net 2.0
hope u all understand...Pls help..
any one have code OR any helpgul Link ????
regards,
koolprasad2003
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|
|
koolprasad2003 wrote: how can i send a mil using MSoutlookExpress which is should be view in the reciever Draft folder,
You cannot target a folder on the receivers end. It will only show up in their Inbox folder, and if the receiver has any sorting rules in place, the receiver moves it to an appropriate folder.
|
|
|
|
|
thankx for reply..
have you any code sample to send the mail using outlookexp ????
please help....
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|
|
You don't use Outlook Express to send emails from your code. Outlook Express is/was a wrapper for MAPI. All you have to do is Google for "VB.NET MAPI".
Or, if you're using .NET 2.0 (VB.NET 2005), look at the classes in the System.Net.Mail[^] namespace.
|
|
|
|
|
koolprasad2003 wrote: it should be view in the reciever Draft folder
You can not stipulate that type of conditions. It is upto the user's email client and filtering rules to decide the routing.
Also note that, Drafts are normally used to store message in composition before being submitted for delivery to Outbox and then to the SMTP server.
|
|
|
|
|
thankx for reply..
have you any code sample to send the mail using outlookexp ????
please help....
regards,
koolprasad2003
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|
|
heres the code
Dim handle As IPictureDisp
handle= getbinerydata();
me.imageCtrl.Picture=handle;
this code works fine in vb6. but doesn't work in VBA(msaccess).
the message is (file not found).
how to show bitmap variable in image control.
Asif Rehman
|
|
|
|
|
MS Access expects your to pass the path and filename to the image control, not a binary object.
Hope this helps.
-------------------------------------------
Damian - Insert snappy one-liner here.
|
|
|
|
|
thanks for reply
what I need to do if had to pass binary varible to image or picture box control.
One option is to save variable to file. then reference it but it looks unprofessional.
Asif Rehman
|
|
|
|
|
Asif Rehman wrote: what I need to do if had to pass binary varible to image or picture box control
Access doesn't support this.
Asif Rehman wrote: One option is to save variable to file. then reference it but it looks unprofessional.
Your options are quite limited because of Access.
|
|
|
|
|
hi, i have an ir receiver connected at serial port. i want to programe it using vb.net. is there any sample code or help to receive ir signal at serial port.
Thanks.
-Waqas
|
|
|
|
|
It's a serial device just like any other. Just because it's an IR receiver, doesn't make it special in any way. It's just like you were talking to a modem.
The web is overflowing with examples of Serial communication. All you have to do is Google for, if you're using VB.NET 2002 or 2003, "vb.net serial comm", if 2005, "vb.net 2005 serial comm".
|
|
|
|
|
Hi,
I am trying to insert selected items from a listbox into a label, the listbox is fillby a database query, the problem is all I get is this System.Data.DataRowView it works fine when I dont use a database query and just text in the listbox, but need to use a database query.
Can anyone help on a solution for this??
Dim i As Integer<br />
For i = 0 To ListBoxUpgrade.Items.Count - 1<br />
If ListBoxUpgrade.Items(i) Then<br />
LabelSum.Text = LabelSum.Text & Space(6) & ListBoxUpgrade.SelectedItem(i) & vbCrLf<br />
End If<br />
Next i
Thanks in advance!
Stefan.
"All answers have a question? All code has an end."
|
|
|
|
|
smguc wrote: ListBoxUpgrade.SelectedItem(i)
try ListBoxUpgrade.SelectedItem(i).Text instead
without .Text the ToString() method gets called, which by default returns a string
naming the type.
|
|
|
|
|
Hi Luc,
Thanks for that, but doesn't accept the .text after the ListBoxUpgrade.SelectedItem(i) so frustrading it works in 'VB6' which is where I have upgraded from to 'VB2005' all because of 'Vista', many different rules and changes.
What I am trying to achieve, is there is a list of items in a listbox which you can multi select and from there show only those selected items in a label as a summary 'like a report'.
Any more suggestions would be much appreciated!
Thanks,
Stefan.
"All answers have a question? All code has an end."
|
|
|
|