|
You never mentioned anything about ASP.NET. It won't work because the account that the ASP.NET process is running under doesn't have any rights to the network, nor does it even get drive mappings. You need to use an account that has rights to the network shares your trying to get to.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Is anybody familiar with this error?
An unhandled exception of type 'System.OutOfMemoryException' occurred in system.drawing.dll
I have two applications that contain the following code:
imgThumbNail = Image.FromFile(strFiles(intCounter))
One applications works perfectly but the other generates the error above.
Does anybody have any idea what is causing this?
Thanks
Brad
|
|
|
|
|
Without seeing the rest of your code, it's impossible to say. Since your loading Icon files, you may be ownerdrawing something? The first thing I'd check for is making sure you're explicitly disposing an Graphics objects that your using.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Here is the sub that I'm using:
Public Sub AddThumbnails()<br />
<br />
Dim strFiles() As String<br />
Dim intCounter As Integer = 0<br />
Dim intTotalFiles As Integer = 0<br />
Dim imgThumbNail As Image<br />
<br />
Dim imgcallback As Image.GetThumbnailImageAbort = New Image.GetThumbnailImageAbort(AddressOf ThumbCallback)<br />
<br />
strFiles = System.IO.Directory.GetFiles("C:\Test1")<br />
intTotalFiles = strFiles.GetLength(0)<br />
<br />
If intTotalFiles = 0 Then<br />
Exit Sub<br />
End If<br />
<br />
Me.lvPics.LargeImageList = ilPicts<br />
Me.ilPicts.ImageSize = New Size(96, 96)<br />
<br />
ilPicts.Images.Clear()<br />
lvPics.Items.Clear()<br />
<br />
Do Until intCounter = intTotalFiles<br />
imgThumbNail = Image.FromFile(strFiles(intCounter))<br />
ilPicts.Images.Add(imgThumbNail.GetThumbnailImage(96, 96, imgcallback, System.IntPtr.Zero))<br />
lvPics.Items.Add(strFiles(intCounter), intCounter)<br />
intCounter = intCounter + 1<br />
<br />
Loop<br />
<br />
End Sub
I’m clearing my controls. Do I need to do more?
Thanks
Brad
|
|
|
|
|
I’ve added imgThumbNail = Nothing at the end of my loop and still no luck.
The error is being generated in the first loop so I guess that clearing the image won't matter anyway.
Brad
|
|
|
|
|
From MSDN:
If the file does not have a valid image format or if GDI+ does not support the pixel format of the file, this method throws an OutOfMemoryException exception.
|
|
|
|
|
Thanks.
I discovered that the images in the directory that I was trying to read were link files (image.jpg.lnk).
I'm trying to solve the problem by trimming off the lnk...
newFileName = file.Name.Replace(".lnk", "")
...and rewrite my path string to go to the file location where the actual jpg lives...
newFilePath = filePath.Replace("Original String", "New String")
I'm still working on that second part... It is complicated by the fact that the Original String is never the same and part of it is used to create the New String . But I think I can figure it out...
Thanks again!
Brad
|
|
|
|
|
Hi,
I am trying to open a web page from my desktop application.
There is any way to pass login credentials (user,password,domain) to the web browser object, so the user don't have to type each time this details?
Thanks,
Wizard_NZ
|
|
|
|
|
1. i am having an openfiledialog. I want the openfiledialog function as opening some file. The file name is abc.vb. We can't open any other file anymore. The filename is already fixed. How to check whether the file I open is abc.vb? Before I am exit the openfiledialog, check will be done to ensure the filename is abc.vb. I have used the filter and filename, but we still can open other files. I don't want it to open other files. Please help me.
2. How to get the startup directory of the windows service? I have used the Environment.Directory, it doesn't work. It will return C:\Windows\System32\.
I try to use Application.StartupPath(), it doesn't work for windows service, it only work for windows application. How to solve it?
Thanks for your idea. Your idea is highly appreciated.
Information is for sharing. Human's idea should be highly appreciated.
|
|
|
|
|
Re:OpenFileDialog
What s the problem in using as follows
Private Sub OpenFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog1.FileOk
If Not Me.OpenFileDialog1.FileName.ToLower.EndsWith("abc.vb") Then
MessageBox.Show("You cannot open this file")
e.Cancel = True
End If
End Sub
|
|
|
|
|
mythinky wrote:
2. How to get the startup directory of the windows service? I have used the Environment.Directory, it doesn't work. It will return C:\Windows\System32\.
Try Application.ExecutablePath . This will give you the complete path to the .EXE that started your app. Just remove the filename from the end of what's returned.
Imports System.IO
.
.
.
Dim path As String
path = Application.ExecutablePath()
path = path.SubString(1, path.LastIndexOf(Path.DirectorySeparatorChar))
This should return the complete path to the executable (not including the filename) appended with the path seperator character ( \ ).
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am trying to develop a simple Hello world program for PocketPC when i test it in PocketPC Emulator it works just fine but when i try tu Run it on my PocketPC - the real one, it fails!
Am I doing something wrong is there anything that I should know?????
soni_xiao
|
|
|
|
|
This question really belongs in the Embedded/Mobil Forum.
But, did you install the .NET Compact Framework (same version as your dev environment) on the Pocket PC?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I think that when I press run (F5) in visual studio dev env it automatically deploys .net CF to PocketPC. at least it does so in emulator.
Thanks anyway
|
|
|
|
|
Hi. I am working on a project which involves one server and many remote apps accessing its features.(A cyber classroom). I have a problem that when i receive a picture from the sever through remoting, i am unable to display it due to some serialization problem. Secondly i am stuck in remoting events. I want a remote event which is broadcasted to all subscribers when fired. If someone could help me, i would be greatley thankful.
|
|
|
|
|
Hi
If you are using the winsock activex control then you need to build some optimizations around your server and client apps. You will find that if you use the SendData sub routine you will have to send data in packets each around 512 to 2048 bits in size and also delay the packets until the SendComplete() event is called each time.
};
|
|
|
|
|
anybody know how to call a form using keyboard key like F3.
and also how to pass a value from a form to a textbox of other form in vb.net.
|
|
|
|
|
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown<br />
If e.KeyCode = Keys.F3 Then<br />
Dim f As New Form2<br />
f.Show()<br />
e.Handled = True<br />
End If<br />
End Sub
Here Form1 is a form having the KeyDown EventHandler and Form2 is just another form.
This code will not work if your Form1 has controls like Textbox and the TextBox control has focus, because the default value of the KeyPreview of Form is False. In order to make working of F3 even the TextBox has focus, You have to set the KeyPreview property to True.
I think this will solve your problem.
|
|
|
|
|
The following will demonstrate passing a value from one form to another.
I have Form1 class with KeyPreview property set to True and class variable of type Form2 which has a TextBox and a Public Property to get or set the TextBox Text. The Form1 class has three EventHandler which will be helpful for getting the Form2 class TextBox Text.
Add the following to the Form1.
Private f As Form2
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
f = New Form2
AddHandler f.Closing, AddressOf SetTextBox
End Sub
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
If e.KeyCode = Keys.F3 Then
f.Show()
e.Handled = True
End If
End Sub
Private Sub SetTextBox(ByVal sender As Object, ByVal e As CancelEventArgs)
If f.TextBoxText.Trim.Length < 1 Then
MessageBox.Show("Type some text in TextBox")
Else
Me.TextBox1.Text = f.TextBoxText
f.TextBoxText = ""
f.Hide()
End If
e.Cancel = True
End Sub
Add the following to the Form2
Public Property TextBoxText() As String
Get
Return Me.TextBox1.Text
End Get
Set(ByVal Value As String)
Me.TextBox1.Text = Value
End Set
End Property
In the Form1 pressing F3 will open the Form2 and when Form2 is closed the TextBox text of Form2 will be set to Form1 TextBox.
I hope this will do.
|
|
|
|
|
I am trying to get word document title and number of word in the document
Currently, I can only get these properties from opening the document.
Is there any way to get these information without actually opening the word
document.
Shin
|
|
|
|
|
No, there isn't. You have to open the document. From what I can see in the file format, those properties are not stored in the file.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thank you for your input,
This is the way to get the document property
Is there any way to open the word document silently?
The source code below is not working.
wordApp.Documents.Open strFileName
wordApp.Visible = False
VB6/Windows2000
Shin
|
|
|
|
|
I found a solution. the dll dsofile.dll
was availble for getting office document
properties with out open. I downloaded and
used from kb. Thank you.
Shin
"Microsoft Knowledge Base Article - 224351 "
Dim oFilePropReader As DSOleFile.PropertyReader
Dim oDocProp As DSOleFile.DocumentProperties
Set oFilePropReader = New DSOleFile.PropertyReader
Set oDocProp = oFilePropReader.GetDocumentProperties(strFileName)
Debug.print oDocProp.Title
'display the title of document
set oFilePropReader = nothing
|
|
|
|
|
how to display a word file as another application on a button click event
www
|
|
|
|
|
Use the Process and ProcessStartInfo classes in your button Click event handler to launch the .DOC file:
Dim procStartInfo As New ProcessStartInfo(fullPathToWordDOCFile)
procStartInfo.UseShellExecute = True
Process.Start(procStartInfo)
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|