|
Yap, that seems the only possible (and the worst) reason.
The need to optimize rises from a bad design
|
|
|
|
|
Certainly.
System.Diagnostics.Process.GetCurrentProcess().Kill()
There is no way to hide it from the Process tab in Task Manager other than killing the process. This is a security measure, and you should not be trying to circumvent it
|
|
|
|
|
If it's that critical, just rename your 'process' to something less conspicuous. Use a little imagination.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
|
|
|
|
|
hi guys, I have a problem, how can I load the picture from file and attach into my datareport,
the problem is, I used Vb6 and ms access 2003 for my backend. In my database barangayClearance, table name is brgyResident and i have a field url for picture path. And in my form that url I named it sFile for variableName. How can i load the picture using the sFile Variable. here is my code
Private Sub btnRequestClearance_Click()
Dim sFile As String
sFile = lblFilePath.Text 'getting image path
Dim cn As New ADODB.Connection
Set cn = New ADODB.Connection
cn.Open "Provider=Microsoft.JET.OLEDB.4.0;Data Source=" & App.Path & "\barangayClearance.mdb;Persist Security Info=False;"
On Error Resume Next
Dim RS As New ADODB.Recordset
Set RS = Nothing
Set RS = New ADODB.Recordset
RS.Open "Select * From brgyResident Where ID = " & ListView1.SelectedItem.Text & "", cn, adOpenStatic, adLockOptimistic
Set DataReport2.DataSource = RS
Set DataReport2.Sections("section1").Controls("Image2").Picture = LoadPicture("sFile" & DataEnvironment1.rscmdSample.Fields(17).Value)
DataReport2.Show vbModal
End Sub
I used DataEnvironment1, connection is cmdSample and DataReport2.
I need to place the Picture in Section1, Image2
anyone who knows, plz help me...
hbaluyot@gmail.com
|
|
|
|
|
I have integrated a feature of plesk 'download backup' which returns the HTTPWebResponse Type Object and i am unable to download the file which it points to . Please help urgently with some code sample.
Thanks in Advance
|
|
|
|
|
I'm hoping to discover what is causing the following security error when I try to automate excel and open a new workbook:
Security Exception was unhandled
Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
I am using the following code (which I have used before with no errors):
Dim oXL As Excel.Application
Dim oWB As Excel.Workbook
Dim oSheet As Excel.Worksheet
'Dim oRng As Excel.Range
Try
'Grab a running instance of Excel.
oXL = Marshal.GetActiveObject("Excel.Application")
Catch ex As Exception
'If no instance exist then create a new one.
oXL = New Excel.Application
End Try
'Start Excel and get Application object.
If oXL Is Nothing Then
Throw New Exception("The Excel libarary could not be loaded. " & _
"You may have an incorrect version of Excel installed. " & _
"Please consult your system administrator. The instantiation " & _
"failed without an exception.")
End If
oXL.Visible = True
'Get a new workbook.
oWB = oXL.Workbooks.Add
oSheet = oWB.ActiveSheet
Anyone have any ideas what I am doing wrong here?
Thanks,
Craig
"That rug really tied the room together."
|
|
|
|
|
Hello everybody,
I want to repair bitmaps where the major part of the picture is shifted to the left by 12 pixels.
So basically I have to shift all the pixels to the right first. To re-complete the picture, the pixels that 'fell over the right edge' (when shifting) have to be 'glued' to the left side. I hope this expression is good enough to explain.
Could someone please give me some leads
a) if this is possible in general (with VB Express)?
b) which techniques / methods I should focus on?
Maybe someone of you has a good idea how to solve that - or at least knows some links that I could examine.
Thank you
Michael
|
|
|
|
|
you can use a function like this:
Function fshiftimage(ByVal sImage As String) As Bitmap
Const nShiftPicels As Integer = 0
Dim iOldImage As Bitmap = Image.FromFile(sImage)
Dim iNewImage As New Bitmap(iOldImage.Width, iOldImage.Height)
Dim cColor As Color
For nX As Integer = 0 To iOldImage.Width - 1
For nY As Integer = 0 To iOldImage.Height - 1
cColor = iOldImage.GetPixel(nX, nY)
iNewImage.SetPixel((nX + nShiftPicels) Mod iNewImage.Width, nY, cColor)
Next
Next
Return iNewImage
End Function
|
|
|
|
|
WOW - Thank you Jan, that sounds promising!
Sorry for another question (I'm pretty new to VB): Do I understand it right that I replace the value of the constant nShiftPicels (in your example 0) with the number of pixels that I want the image to be shifted?
|
|
|
|
|
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.
|
|
|
|