|
Hi again thanks for your help I have found out how to do it I thought i might post this for other people's refrences:
Imports System.Security
Imports System.Threading
AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolivy.WindowsPrincipal)
Dim t As Thread = Thread.CurrentThread
Dim p As Principal.WindowsPrincipal = t.CurrentPrincipal
Dim wi As Security.Principal.WindowsIdentity = p.Identity
Dim UserName As String = wi.Name
' then You can write that userName to your log event and this should give you the identity of
' User loged on
LogEventInfo("Login in As: " & UserName)
Thanks,
Kind regards
Wesam
|
|
|
|
|
Great, Thank you for your reference code.
|
|
|
|
|
hellow to all
i had done a program with vb , and i had made an install to it ,
now let say i wanna update something in the program !
i have to uninstall the program from the ProgramFiles , and then reinstall it ! , anyone have idea how can i creat an exe file with the titel update that can update the program when i run it ...
any one have anyidea or links ? , thxx
|
|
|
|
|
|
I've been learning vb.net 2005 for a few months now and finally finished up and my friend told me next i should try some tutorial's so does anybody know some good one's?
|
|
|
|
|
|
I already learned the basic's of vb.net 2005 and then some but need some guides for that next step to really test my porgramming skills
|
|
|
|
|
|
I have a combobox with 12 numbers listed in it. A user can either select a number, or type it in. I have a command button that will push the selected item into a local database. When I go back to the form, I still see the selected value.
How can I have that selected item cleared once the data is saved to the database? I know i can use this: cboSelectedItem.text = ""
However, if I have 50 comboboxes, that would be kind of tedius.
All my textbox controls seems to clear the data fine, because I have it bound to a dataset so when I clear the dataset, the data in the textbox items clear as well.
So I tried to have a collection of items on my combobox plus have it bound to a bindingsource, but Vb.net didn't like that either.
Any advice is greatly appreciated.
Rashar
|
|
|
|
|
i think one way you can follow is to define a variable as Controls....and then put a for loop for each variable in Controls.....then u can have a if statement or case statement inside which can filter all the Comboboxes and in that block u can clear the combobox.....and one thing is "Control is the base class for Buttons, ComboBox, Textbox etc. You may need to cast to appropriate type."
this could be something like....
Dim ctr As Control
For Each ctr In Controls
If TypeOf (ctr) Is ComboBox Then
CType(ctr, ComboBox).Items.Clear()
End If
Next
like that it can clear all the comboboxes in that form.
This could be one way. anyhow may be you have to format the code a bit, this is just an idea though
|
|
|
|
|
Ahhh... That worked nice.
Thanks soodmonu!
|
|
|
|
|
I am trying to build a program that will select 10 random user names from a list. I need this program to then store that list in a file so that when i run the program again it will not select those ten users. Does any one have any ideas where i can get a start on this. i am somewhat new to VB programing so any pointers would be greatly appericted.
|
|
|
|
|
|
I have a datagrid with a checkbox in it, when the checkbox is checked it writes its value to a hidden control (via javascript). There is multiple pages in this datagrid, and when I go to page two, then back to page one, my checkbox's are not checked and the hidden control is not populated either.
Anyone know a trick to keep the checkbox's selected as well as the hidden textbox populated with each checkbox's id?
This is VS2003 and VB.Net
Steve Welborn
Software Engineer
BitWise Solutions
|
|
|
|
|
You'll have better luck asking this in the ASP.NET Forum.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I knew that..thnx
Steve Welborn
Software Engineer
BitWise Solutions
|
|
|
|
|
Somehow a Windows application is closing when trying to dispose of the calling form using me.dispose.
If .. = True Then
Dim SelectFiles As New frmSelectClearingFiles
SelectFiles.Show()
Me.Dispose()
Else
..
Any ideas?
Jon
|
|
|
|
|
Please tell me this code isn't on your startup form!
If you close, or dispose, the startup form, you're entire application dies. The startup form has the applications message pump attached to it. If that goes away, so does your app.
Dave Kreskowiak
Microsoft MVP - Visual Basic
-- modified at 12:56 Tuesday 27th June, 2006
|
|
|
|
|
Yep, it's the startup form, thanks.
Jon
|
|
|
|
|
I'm in need of being able to create MS Word documents and edit them from VB 6.0. I know that this can be done via VB .NET and also C#; but I'm wondering if all of the calls the VB .NET and C# make to Word are also available in VB 6.0? Thanx!
-Kris
|
|
|
|
|
Yes.
All of the calls that VB.Net and C# can make via the Interop are also available in VB6.0 by referencing the MSWord.olb file in your project.
I suggest you get an MS Office Word Language Reference book to find out the object model and functions available.
"Democracy is two wolves and a sheep voting on what to have for dinner" - Ross
Edbert
Sydney, Australia
|
|
|
|
|
Yes all the calls are available
Check this
Dim MyPath as string = "c:\test\"
Set ObjWordKit = CreateObject("Word.Application")
With ObjWordKit
.Visible = True
.Documents.Add (MyPath & "yourtest.dot")
.activedocument.Bookmarks("MyText").Select
.Selection.Text = "set into word text"
end with
if you need other functions from Word, make a Word-macro and just copy the code and you are close.
Hope this helps
Jesper
|
|
|
|
|
I was wondering if anyone knows of a way to call a C# program from Visual Basic 6.0. I currently have a VB 6.0 application and I'd rather not have to go through the pain in upgrading it to VB .NET but I need to enhance it to call some C# code. Does anyone know if this is even possible in VB 6.0? Thanx!
-Kris
|
|
|
|
|
You can enable COM-Interop registration in the properties of the assembly. You can then use it like any other COM library.
|
|
|
|
|
Hi All - Need ur help
Hi, I am jats working as a s/w Developer. I need some help from u.
I am new to .net and using it from past 2 weeks. During my project i got a problem.
My project has a requirement of sending mail to some mail a/c, when user clicks on a submit button.
I wrote some code for it but i am getting a Inner Exception saying.....
"Failure sending mail.Unable to read data from the transport connection:An existing connection was forcibly closed by the remote host"
The code is as follows………
Private Sub SendMail()
Dim smtpClient As SmtpClient
Dim message As MailMessage
Dim fromAddress As MailAddress
smtpClient = New SmtpClient()
message = New MailMessage()
Try
fromAddress = New MailAddress("from@xxx.com")
smtpClient.Host = "Smtp Server string"
smtpClient.Port = 25
message.From = fromAddress
message.To.Add("to@xxx.com")
message.Subject = "Feedback"
message.Body = "This is Body Part"
smtpClient.Send(message) '*****Raising Exception here*****
MsgBox("Email successfully sent.")
Catch ex As Exception
MsgBox("Send Email Failed." + ex.Message + ex.InnerException.Message)
End Try
End Sub
Note: I am not using any mail server is it neccesary to do so. If it is plz specify me One mail server.
Plz send me some Document to relevent topic if u hav it. And ur suggesstion on this topic.
Waiting for a positive response…..
jats.
jats_4ru@yahoo.co.in
|
|
|
|