|
Hai,
I am facing the following problem when I am doing with my vb project,
In my program I need to copy files from Server to client. If client is not having sufficient privilages, then it should prompt for admin account and copy it in admin account.
When I try to copy a file through user account insufficient privilage message ,I got.
Through net ,I found that we can do it using 'Run as' command.
But i don't have clear idea to use it in VB.
Can anybody help me to show the right way to do this?
Thanks very much in advance.
Thank You,
rahul.p.menon
|
|
|
|
|
I've developed a website thro' and i'd like to see the suggestions of the users.
For that purpose i'd like to get the feedback from the users once they fill in the form.
The feedback must be sent to my email id automatically from the filled in information
when i tried i got the following error.................................
----------------------------------------------------------
the code goes like this
----------------------------------------------------------
Dim myMailServer As SmtpMail
myMessage.BodyFormat = MailFormat.Text
myMessage.Priority = MailPriority.High
myMessage.From = "xyz@urdomain.com" 'From Address
myMessage.To = "mymailid@mydomain.com" 'To Address
myMessage.Subject = "hi"
myMessage.Body = "hello"
myMailServer.SmtpServer = "smtp.net4india.com"
'This is my mail server
myMailServer.Send(myMessage)
myMessage = Nothing
----------------------------------------------------------
error msg is like this
----------------------------------------------------------
The transport failed to connect to the server.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: The transport failed to connect to the server.
Source Error:
Line 103: myMailServer.SmtpServer = "smtp.net4india.com" 'This is my mail server '
Line 104: myMailServer.Send(myMessage)
|
|
|
|
|
The SmtpServer property and Send method are static. Don't use a reference.
SmtpMail.SmtpServer = "smtp.net4india.com"<br />
SmtpMail.Send(myMessage)
---
b { font-weight: normal; }
|
|
|
|
|
You have not created the object myMailServer . You have just declared it
Divya Rathi
|
|
|
|
|
! Hello everyone,
I need help.
I want to get the filestream or memorystream from Image Object.
Dim img As Image
Dim path As String = "temp"
Dim fs As IO.FileStream
Dim br As IO.BinaryReader
Dim bytes() As Byte
Dim sqlImg As SqlTypes.SqlBinary
Try
img = picPhoto.Image
img.Save(path)
fs = New IO.FileStream(path, IO.FileMode.Open, IO.FileAccess.Read)
br = New IO.BinaryReader(fs)
bytes = br.ReadBytes(fs.Length)
sqlImg = New SqlTypes.SqlBinary(bytes)
SQL_Parameter(i).Value = sqlImg
'Save Image to Sql Database
Catch ex As Exception
Throw ex
Finally
If Not br Is Nothing Then
br.Close()
br=Nothing
End If
If Not fs Is Nothing Then
fs.Close()
fs = Nothing
End If
bytes = Nothing
img.Dispose()
sqlImg = Nothing
End Try
'It is working but sometime throw the error
' A generic error occurred in GDI+
'Thanks.
!alien!
|
|
|
|
|
Try using Save method.
Nibu thomas
Software Developer
|
|
|
|
|
This code will convert any imageformat to a MemoryStream.
<br />
Imports System.Drawing.Imaging<br />
Imports System.IO<br />
<br />
Public Class Form1<br />
<br />
Public JpegStream As MemoryStream<br />
Public myImageCodecInfo As ImageCodecInfo = GetEncoderInfo("image/jpeg")<br />
Public myEncoder As Encoder<br />
Public myEncoderParameter As EncoderParameter<br />
Public myEncoderParameters As EncoderParameters<br />
<br />
<br />
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
<br />
Dim filename As String = "C:\test.jpg"<br />
Dim Bmp = New Bitmap(filename)<br />
JpegStream = Nothing<br />
JpegStream = New MemoryStream<br />
<br />
Bmp.Save(JpegStream, myImageCodecInfo, myEncoderParameters)<br />
' Image is now in MemoryStream<br />
End Sub<br />
<br />
Private Function GetEncoderInfo(ByVal MYmimeType As String) As ImageCodecInfo<br />
Dim i As Integer<br />
Dim encoders As System.Drawing.Imaging.ImageCodecInfo() = Imaging.ImageCodecInfo.GetImageEncoders()<br />
For i = 0 To (encoders.Length - 1)<br />
If (encoders(i).MimeType = MYmimeType) Then<br />
GetEncoderInfo = encoders(i)<br />
End If<br />
Next i<br />
End Function<br />
<br />
End Class<br />
<br />
Remember to close all objects when done.
Programming is like Mathematics… you take ONE step at the time!
-- modified at 12:11 Friday 24th February, 2006
|
|
|
|
|
Thanks you for your reply.
!alien!
|
|
|
|
|
your welcome!
Programming is like Mathematics… you take ONE step at the time!
|
|
|
|
|
i m working on vb.net project it is runing nice if i run it on my machine. if i copy its exe in another machine it show problem in another machine . i m using mxflexgrid component of vb and excel refrence it show error in these parts and if i run it on both machine in same time then it show problem related to sql server database.
please helpn me
for sql server it show error-the maximum simultaneous user count of 1 license for this standard edition server has been exccedd.
additonal licenses should be obtained and isstalled or u should upgrade to full version
and for mshflexgrid and excel ref it show---
for assembly name axinterop mshflexgridlib or one of its dependencies was not found
vivek
|
|
|
|
|
Well your English is quite poor so I don’t understand all you said.
For the “mshflexgrid« problem: you do not have the required assemblies on that computer.
And if I understood you right for the SQL server part: your version only supports one connection at a time (as the error message says) and so you can’t be connected more times than that.
You should really read the messages as they are quite helpful.
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
Hi all,
Im Working with Excel Macro facility.
i need to write some text in notepad.how can i open a notepad from vba..
(in VBA we can add commondialog control box and open a notepad.. i need some other way)
Help ME
Thanks n Regards,
Ramya.R
-- modified at 4:04 Friday 24th February, 2006
|
|
|
|
|
/*The following code Opens notepad when a key is pressed . When the up key is pressed , notepad will open */
Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
Dim keyPress As Double
If KeyCode = vbKeyUp Then
keyPress = Shell("notepad.exe", vbNormalFocus)
End If
End Sub
Divya Rathi
|
|
|
|
|
Thanks Divya,
I use VBA in Macro level..still no forms are used...
by using shell("notepad.exe") command i open the Note pad..
I need to append the data to that opened Notepad and save that file...
Help me Please..
Thanks in advance....
Thanks n Regards,
Ramya.R
-- modified at 4:10 Friday 24th February, 2006
|
|
|
|
|
this shd be useful
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnofftalk/html/office09072000.asp
|
|
|
|
|
why do u explictly need to create notepad ? coz if u want to save data from some text box then there are many file handling operations are there.
Divya Rathi
|
|
|
|
|
I make a application with a numbers of forms,
When I open the application in client computer,
I found some of them chnage their screen to higher DPI.
This affect my application label become a larger font.
Beside, A client change its window font,
It doesn't matter that I have setted the form face and the font size,
the whole view of my form style is totally changed.
So, does any method to handle these case?
Thank you!
|
|
|
|
|
It appears it is time once again to show my stupidity. I hope as i only got .net a few days ago i can be forgiven... I'm still converting my brain over from VB6.
1. I am attempting to find the .net equivalent of VB6's "Open ("C:\Text.txt") as input"... statment... basically just generic loading and saving of text and variables... if you want to give examples, lets just deem the file path as the C:\text.txt file. it getts easier than "INSERT PATH" or the like. I have found many examples in my research, but they tended to be variations, so im not sure whats what.. i really just want a simple explination with a breakdown of the parts and their functions.
2. I need to figure out how to bind Database fields to textboxes in .net.. there used to be a property for it, but that is no longer on the list. I have Office XP (2002) and intend to use access. I also have a guide that shows me how to convert access to SQL files, but thats another matter.
Any help would be much appreciated... and please think no less of me. lol The only bad thing from converting over is feeling like im back in 8th grade... (when i learnt VB6)...
"Love, Life and Option Explicit"
|
|
|
|
|
You can access files via the System.IO.File class.
Here's a quick example on how to read a text file.
Dim sr As System.IO.StreamReader
Dim text As String = String.Empty
Try
sr = System.IO.File.OpenText("c:\text.txt")
text = sr.ReadToEnd()
Catch
Finally
If (Not (sr Is Nothing)) Then sr.Close()
End Try
And right, the standard TextBox doesn't take a DataSource. You'll either have to push your database info into it yourself or use a different control.
|
|
|
|
|
just so i understand:
Dim sr As System.IO.StreamReader sets the variable sr as a file that is read.
Dim text As String = String.Empty sets the text variable to blank.
Try I assume is like a VB6 loop.
sr = System.IO.File.OpenText("c:\text.txt") reads the file.
text = sr.ReadToEnd()CatchFinally inputs the file into the variable... not sure on the CatchFinally...
If (Not (sr Is Nothing)) Then sr.Close() if the file is blank, stop.
End Try again assume is like ExitDo...
i'll look up the Try sequence.. will probably make more sense then.. i think i am getting it now... as for the Databaseing, anyone know a simple tutorial page for setting up a DB... basically i want to set up when i load the DB, it loads the information into variables. I then will use these variables for textboxes, and some sub-manipulation. (Gold + Income - Expenses)
"Love, Life and Option Explicit"
|
|
|
|
|
ThePmanLives wrote: Dim sr As System.IO.StreamReader sets the variable sr as a file that is read.
It declares a StreamReader reference variable. It has not been assigned a StreamReader object yet. So at first, it references "Nothing".
Files are read in streams. Think of a stream as an array of bytes, which could come from memory, the hard disk, floppy disk, etc.
ThePmanLives wrote: Dim text As String = String.Empty sets the text variable to blank.
Yes. It creates a string variable and immediately assigns it to a string object having no characters. "Empty" is a Shared (static in C#) property which returns a predefined empty string object.
ThePmanLives wrote: Try I assume is like a VB6 loop.
No. Keywords "Try", "Catch", and "End Try" are used together in exception handling. Any exception thrown in a Try block will get caught in the Catch block. Such as a FileNotFoundException. You should always use exception handling when working with files, because they're more likely to occur there.
The closest thing to this in VB6 is the "On Error GoTo" statement. In VB.NET, Microsoft decided to implement exception handling the same way it is done in C++, C#, and Java.
ThePmanLives wrote: sr = System.IO.File.OpenText("c:\text.txt") reads the file.
text = sr.ReadToEnd() outputs the file into the variable
Yes. Pretty easy eh?
|
|
|
|
|
Okey. makes a LOT more sense now. thanks... 1 last question though. what does the:
Finally
If (Not (sr Is Nothing)) Then sr.Close()
line do? Is it part of the try/catch? or is it just closeing the file afterward? (the main thing is the "finally". never seen that in vb6, so it must be new)
"Love, Life and Option Explicit"
|
|
|
|
|
"Finally" is part of the Try/Catch block.
The code within the Finally block always gets executed, regardless if an exception has occurred or not. The Finally code is executed after the Try block has been executed without exceptions or after the Catch block has been executed.
The reason it is needed is because the Try block code might not be fully executed because an exception can occur in the middle. This means any cleanup code at the bottom of the Try block will get skipped on exceptions. The Finally code is always executed, so its a good place to put cleanup code.
Take a look at this MSDN article for more details.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vastmtrycatchfinally.asp[^]
|
|
|
|
|
Dear All,
I need to convert the Excel file in the Following format to XMl file Specified Below..Please Help me to come over from this difficulty...
Taskid Name OutlineLevel Colvalue
110i Design 3 L4_R_D04.002
111i Coding 3 L4_R_D04.004
112i Testing 3 L4_R_D04.006
<tasks>
<task Taskid="110i" Name="Design" Oulinelevel="3">
<colValue>L4_R_D04.002</colValue>
</task>
<task Taskid="111i" Name="Coding" Oulinelevel="3">
<colValue>L4_R_D04.004</colValue>
</task>
..........
</tasks>
Thanks n Regards,
Ramya.R
-- modified at 0:06 Friday 24th February, 2006
|
|
|
|
|
the error is this :
A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.)
its stuck when its come to Myconn.open().
whats wrong with this code?
conMyData = New SqlConnection(ConfigurationManager.AppSettings("psmConnectionString"))
cmdSelect = New SqlCommand("sp_ValidateUser", conMyData)
cmdSelect.CommandType = CommandType.StoredProcedure
parmReturnValue = cmdSelect.Parameters.Add("RETURN_VALUE", SqlDbType.Int)
parmReturnValue.Direction = ParameterDirection.Input
cmdSelect.Parameters.Add("@noPekerja", SqlDbType.VarChar)
cmdSelect.Parameters.Add("@pWord", SqlDbType.VarChar)
conMyData.Open()
cmdSelect.ExecuteNonQuery()
intResult = cmdSelect.Parameters("RETURN_VALUE").Value
conMyData.Close()
|
|
|
|