|
With an 8MB bitmap the above function throws an "out of memory exception" at the second line (Dim iOldImage As Bitmap = Image.FromFile(sImage)).
The reason for this must be that it is a DPX Bitmap - the function works fine with standard formats as JPG. Searching for details I found that only a few bitmap formats are supported by GDI+.
Is it possible to expand the GDI possibilities or do I have to drop the idea to use the function?
Thank you in advance
Michael
modified on Monday, September 29, 2008 9:32 AM
|
|
|
|
|
Sorry, nut here I cant help. I think closing all other apps will maybe help. It seems that the complete picture must fit into memory.
Maybe someone else has an idee
|
|
|
|
|
Yes the const means the sift in pixels
You can even adapt the function and make it a parameter
Jan
|
|
|
|
|
Thanks for looking again, Jan.
Your function (slightly adapted) works fine with JPG, BMP etc., while i tried to open and modify a DPX bitmap. Meanwhile I found out from the help files GDI-Grafikformate that GDI+ does only support a limited number of standard formats (like JPG, BMP etc.). So the error messages neither had to do with my memory nor with your function.
|
|
|
|
|
I have a small VB app that is supposed to pull a set of records from an IBM DB2 Database and populate them into my vbapp. I know my DB2 connection works because I have several other reports that can access it. I am creating the connection string on the fly... but something is getting confused in the connection string. I've tried moving my connection strings around, but nothing is seeming to work.
When I run the app... I get the following message.
...Drivers SQLSetConnectAttr failed...
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim startdate As String = DateTimePicker1.Text
Dim enddate As String = DateTimePicker2.Text
Dim statement As String = "SELECT DICT_NAME FROM DS004T01 WHERE SYSTEM_PREFIX = 'VL' and TYPE_DATE >= '" + startdate + "' and type_date <= '" + enddate + "'"
Dim cmd As Odbc.OdbcCommand
Dim hl7reader As Odbc.OdbcDataReader
Dim sql As String
Dim tmp1 As String
Dim conn As Odbc.OdbcConnection = New Odbc.OdbcConnection("driver={IBM DB2 ODBC DRIVER};Database=xxxx;hostname=xxx.xxx.xxx.xxx;port=xxxx;protocol=TCPIP; uid=xxxxxxx; pwd=xxxxxx")
Try
conn.Open()
sql = statement
cmd = New Odbc.OdbcCommand(sql, conn)
hl7reader = cmd.ExecuteReader
Do While hl7reader.Read
tmp1 = hl7reader("dict_name")
ComboBox1.Items.Add(tmp1)
Loop
Catch ex As Exception
MsgBox("Error" & ex.Message)
End Try
End Sub
|
|
|
|
|
Just throwing ideas at you since I've never created a connection like what your trying to do.
1. Copy the connection string from one of your existing working apps and your current app into a text file and compare them side by side.
2. Try using a OdbcConnectionStringBuilder and set the properties and pull the connect string from it (search OdbcConnectionStringBuilder class on MSDN for an example).
Any suggestions, ideas, or 'constructive criticism' are always welcome.
|
|
|
|
|
I want to be able to have the user/installer type in the Connection string to the database during installation. I can find how to creat the textbox fields so the user can type them in, but I can't find the examples of how to get those values.
Lets say I want to get the value in the txtbox and just create a settings.txt file with that value in it.
Can anyone point me in the write (right) direction to be able to do that?
Thank you
|
|
|
|
|
Try to create a configuration window, the first time that your application is running on a PC and verifies that the configuration does not exist, show the configuration window. This way you can change the settings at any time if necessary.
Greetings
|
|
|
|
|
Hello,
How could I trace which form was previously loaded within my application? Sorry but I'm a bit lost on how to explain this let alone put this into code.
Here's the story, I have an application which loads to form1. From form1 I can load to form2. Then from form2 I can load back to form1 taking a couple of variables to display in my datagrid in form1. So I was looking at a broken code like this
If previous form = form1 then
execute cmd1
else if previous form = form3 then
execute cmd3
etc....
Any help would be greatly appreciated. Thanks in advance
Aim small, miss small
|
|
|
|
|
Implement a shared variable on the form and increase it in the constructor and decrement when destroying the form.
Something like,
class whatever
Implements IDisposable
Private mblnDisposed As Boolean = False
Public Shared iCount As Integer = 0
Sub New()
iCount += 1
End Sub
'Dispose, etc down here
end class
Any suggestions, ideas, or 'constructive criticism' are always welcome.
|
|
|
|
|
You're treating forms like a trail of breadcumbs. This is not the case. Forms create instances of other forms in a hierarchical fashion. If, say, Form1 creates an instance of Form2 to get some data, Form1 should call Form2's .ShowDialog method, not Show . This way, Form1 will know exactly when Form2 is closed and is free to grab any data it needs from it. Form2 should not care at all which form created it, nor should it care about what data it needs to pass back to the form that called it. It's not Form2's job to do any of this. Form2's job is just to get data from the user or whever, not to pass it around. Form1 should know which methods it needs to call on Form2, not the other way around.
|
|
|
|
|
Dave Kreskowiak wrote: You're treating forms like a trail of breadcumbs.
yeah I guess you're right.
Dave Kreskowiak wrote: Form1 should call Form2's .ShowDialog method, not Show
got it! Form1 calls upon data that form2 generates not form2 passes the data back to form1. Many thanks again for the tip!
Aim small, miss small
|
|
|
|
|
Iam using entity list in my project and i want to use the sort finction how can i use that?
Dim GiftList As New List_test
Dim ent As Ey_test
For I As Integer = 1 To 100
ent = New Ey_ps_giftvoucher
ent.Psgv_vchnumber = "V000" & I.ToString.PadLeft(3, "0")
GiftList.Add(ent)
next
Iam getting the sort finction in property of giftlist but i dont know how to use that??
GiftList.Sort
|
|
|
|
|
It's impossible to say considering we don't know which object you're looking to sort and which classes you derived those collection objects from.
|
|
|
|
|
Hi all..
I am creating an application using VS2005 and I have connected it with MS Access 2003.
I have used a splash form which displays the owner name and its company name.
The problem is when I am running program through VS2005 it runs well but when I am trying to run it seperately it is giving an error message "Program has stopped working. Send this report to Microsoft"
I have not used any referrence or any .dll file with program.
Help me to solve this problem...
Gagan
|
|
|
|
|
Without knowing what the app was doing at the time of the crash, or what the code looks like around that point, it's impossible to tell you anything useful, other than trying to run the debug version outside of the IDE, then, when it crashes, connect the debugger to it.
|
|
|
|
|
Hi all..
I wan't to know that how to check if program is started by a user or by system?
Help me...
Gagan
|
|
|
|
|
Check the applications current user?
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hi everyone, i'm developing an application for a takeout & delivery restaurant. Using VB 2008 and MS Access for database and this application is driven by database.
selected category will display its items and will be generated as a button at runtime.
i will use button array and fill they with item name as "data" and handle by Addhandler addressof functionName
question1: is there a better way than using array of buttons? can i dynamically generate these buttons and add handler?
question2: left click will simply plus 1 item according to the button, right click will substact 1 item. can anyone tell me how to do right click detection with buttons generated dynamically.
hopefully i am explaining my situation clear enough, please let me know if i'm not making it clear.
thank you for reading.
WillRain
|
|
|
|
|
Sure, you can dynamically generate buttons.
Create your new button:
dim myButton as new button
with myButton
.size =...
...
end with
me.controls.add(myButton)
Then add the handlers.
To differentiate between left and right click simply use in your button-click-event:
if e.mousebuttoons = mousebutton.right then ...
|
|
|
|
|
i understand that e.mousebuttons (e) is the system.windows.forms.mouseeventargs, and of course that if statement will catch if the right mouse botton is clicked.
my question is "e" from the button function paramter is a system.eventargs, not the system.windows.forms.mouseeventargs. how do i code it so i can get the mouseeventargs?
also the program seems like only detecting the left click at runtime unless i already create an object and select mouseUp, can you please explain a little more on this part? thank you.
WillRain
|
|
|
|
|
Hi Smithers-Jones:
I have solved those problems, thx.
WillRain
|
|
|
|
|
Hi All,
I am using vb.net2008 and sql server 2005
I have a form there is only one button and a label
and in button click doing some delete operation in the table. I need when I am Click the Button then a message will display on lable that "Deleting..." and after deletion the message will removed.
at the start of the Button Click I am writing :
lable1.text="Deleting..."
.
.
.
Then writing the code for deletion
After complete the deletion I am writing
Label1.text=""
The Problem is the label does not Shows its value, Or Shows when the deletion is complete.
So, What I am doing for it?
Arindam Banerjee
Sr. Software Developer
Rance Computer Pvt Ltd.
Kolkata (India)
|
|
|
|
|
There are better ways but:
1. create a boolean variable
2. add a timer to your project with a small interval
3. in the timer's tick event:
a. check for the status of the boolean
b. change the text of your label to "" when the boolean is true
c. set the boolean back to false
d. stop the timer
4. move the deletion code to its own sub and at the end of the
sub change the boolean variable to True
5. create a thread address of of your deletion sub
5. in the click event of your button:
a. start the timer
b. set the label's text to "Deleting..."
c. start your thread
My advice is free, and you may get what you paid for.
|
|
|
|
|
Try doing label1.refresh after setting the text each time.
Bob
Ashfield Consultants Ltd
|
|
|
|