|
hey guy
if u r in ur home u follow ur home,s rule not to other,s same
like when u work in microsoft it has also there rule
ok don,t ask this type of question.
read it private, public, partial property to set the class
byeeeee
hope u understand
lucky
|
|
|
|
|
Speaking of rules...
Do NOT use SMS Speak in the fourms. It makes your posts quite difficult to read. You've got a 101+ key keyboard in front on your, use it!
Lucky Sheikh wrote: hope u understand:
Barely, just barely.
|
|
|
|
|
I am having a problem with changing an image using the "Image.FromFile(Path)" method. On startup, everything works fine, but as soon as I use the "openFileDialog" box, the system won't open the selected image any longer.
Every time the mouse hovers over a button, I want it to change the image of the button. This works even after opening another form and closing it again. But as soon as I select an image using the "openFileDialog" box then the system crashes out every time I hover over one of the buttons that I want the image changed.
After using the "OpenFileDialog" box, I dispose of it, in an attempt for it not to clash with Hover methods.
What can I do to avoid this problem?
Evan Saunders
|
|
|
|
|
i think after ur code, try the picturebox.load before anything
phatkin
|
|
|
|
|
after which code, the "OpenFileDialog" or the "image.fromfile()" for the hover?
|
|
|
|
|
after image.from file,
my VS got corrupted on ma vista so cant check for u today but i hope it works or sam1 else helps u
phatkin
|
|
|
|
|
EvanSaunders wrote: then the system crashes out every time I hover over one of the buttons
What buttons?? In the OpenFileDialog??
EvanSaunders wrote: that I want the image changed.
The OpenFileDialog doesnt' fire off any events, so I don't know where you're changing whatever image.
What's the exception that's thrown?? Does your entire system crash (Windows), or just your app??
|
|
|
|
|
I have the buttons in my main menu...(the openfiledialog box is in a form opened by the main menu)
I choose an imagefile from the opendialog box to load an image on another form for another task, but as soon as I do this, and go back to the main menu, my main menu hover buttons won't change images any longer.
The exception thrown is that my created system crashes with the exception that the image path doesn't exist. Strange exception seeing that it loaded before...
|
|
|
|
|
I still don't know exactly what your code is doing, nor if the button in your main menu (which are not buttons BTW) are the same as your "hover buttons" (whatever those are...), but...
If you loaded the file with Image.FromFile(), or anything else like that, the file get's locked for the lifetime of the object that loaded it.
You might want to take a look at this[^] for a way around that lock.
|
|
|
|
|
Hover Buttons are, as explained, normal buttons. The reason I call them that is because I have a method for changing their image when the mouse hovers over a particular button. Thanks anyway for trying to help...;P
|
|
|
|
|
The situation is not clear, and you did not show any code. So the following is a wild guess,
i.e. the facts are correct, whether they apply to your situation is uncertain:
Image.FromFile() keeps the file open for as long as the image lives (the reason is
some image files, such as JPEG, contain additional information, which remains available
to GetPropertyItem() but is not loaded into memory permanently).
There are two ways to resolve this:
1. don't use FromFile(), use FromStream() instead.
2. immediately make an image copy for use inside your app, and Dispose of the original image,
freeing the file.
Hope this helps.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I get what you are saying...I figured out an easier way to keep the information, using your logic...
I loaded the images into the resources folder, and then when I change the image of a button when hovered over by the mouse, I can just call it from the resources directly.
Apperantly, when loading the project/system, the default directory is set to the ../bin/debug/ folder. When using the OpenFileDialog, the default directory is then changed, which doesn't allow me to select an image implicitly the way I was doing it.
Thanks for the trouble
|
|
|
|
|
EvanSaunders wrote: the default directory is set to the ../bin/debug/ folder
Sometimes. If you create a desktop shortcut, you can choose the initial "current directory"
to be any existing directory.
When using the OpenFileDialog, the default directory is then changed
Sometimes. The File Dialogs have a property that controls whether the current directory
gets changed permanently or not.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Thanx, I'll check if setting property to "false", in regards to the current directory.
|
|
|
|
|
EvanSaunders wrote: I loaded the images into the resources folder, and then when I change the image of a button when hovered over by the mouse, I can just call it from the resources directly.
I had no idea you were changing the images on the buttons using Image.FromFile().
This is definitely the proper way to go when dealing with the images on controls like you are. Loading from resources is quicker than loading from files as the mouse passes over them.
EvanSaunders wrote: Apperantly, when loading the project/system, the default directory is set to the ../bin/debug/ folder.
The CurrentDirectory is set to whatever folder the .EXE was launched from. The problem you, apparently, ran into is that you used relative paths (actually, NO path) in your code to load the image files. When the CurrentDirectory changed, so did the path that your code assumed was the correct path to find those image files.
It's good practice to always build and use fully qualified paths to any files that your app uses. An example of such:
Dim imageFilepath As String = Path.Combine(Application.StartupPath, "image.bmp")
This code doesn't rely on the current directory at all. It relys on a known path that cannot change during the lifetime of the applications session and just appends the filename to this known path. The CurrentDirectory can change all it wants and it won't affect this code.
|
|
|
|
|
Thanks so much, this code is very useful...
|
|
|
|
|
can somebody explain the code for me? I will appreciate for the help...
the following code is some part of the example that i take from internet,and i not really understand on it...
Private Sub Receiver(ByVal sender As Object, ByVal e As SerialDataReceivedEventArgs) Handles COMPort.DataReceived
' Note this subroutine is executed on the serial port thread - not the UI thread.
Dim RXByte, Nibble As Byte
Dim RXArray(2047) As Char
Dim I As Integer = 0
Do
RXByte = COMPort.ReadByte
Nibble = (RXByte >> 4) + 48 ' Convert received byte to Hex
If Nibble > 57 Then
Nibble = Nibble + 7
End If
RXArray(I) = Chr(Nibble)
I = I + 1
Nibble = (RXByte And 15) + 48
If Nibble > 57 Then
Nibble = Nibble + 7
End If
RXArray(I) = Chr(Nibble)
I = I + 1
RXArray(I) = " "
I = I + 1
SpaceCount = (SpaceCount + 1) And 31 ' Insert spaces and CRLF for better readability
If SpaceCount = 0 Then ' Insert CRLF after 32 numbers
RXArray(I) = Chr(13) ' CR
I = I + 1
RXArray(I) = Chr(10) ' LF
I = I + 1
Else
If (SpaceCount And 3) = 0 Then ' Insert two extra spaces for each 4 numbers
RXArray(I) = " "
I = I + 1
RXArray(I) = " "
I = I + 1
End If
End If
Loop Until (COMPort.BytesToRead = 0)
Dim RxString As New String(RXArray, 0, I) ' Convert the first part of the Char Array to a String
' Put a message with a delegate, which points to the display routine and holds the RxString,
' on the message queue and return immediately.
Me.BeginInvoke(New StringSubPointer(AddressOf Display), RxString)
End Sub
' Text display routine, which appends the received string to any text in the Received TextBox.
Private Sub Display(ByVal Buffer As String)
Received.AppendText(Buffer)
End Sub
' Transmitter subroutine.
Private Sub Transmitter(ByVal sender As Object, ByVal e As EventArgs) Handles SendButton.Click
Received.AppendText("TX" & vbCrLf) ' Switch to a new line after every transmission
SpaceCount = 0
Dim TextString As String
Dim TXArray(2047) As Byte
Dim I As Integer
Dim J As Integer = 0
Dim Ascii As Boolean = False
Dim Quote As Boolean = False
Dim Temp As Boolean
Dim Second As Boolean = False
Dim TXByte As Byte = 0
Dim CharByte As Byte
If COMPort.IsOpen Then
TextString = Transmitted.Text
For I = 0 To TextString.Length - 1
CharByte = Asc(TextString.Chars(I))
If CharByte = 34 Then ' If " Then
Temp = Ascii
Ascii = Ascii Or Quote
Quote = Not (Temp And Quote)
Else
Ascii = Ascii Xor Quote
Quote = False
End If
If Not Quote Then
If Ascii Then
TXArray(J) = CharByte
J = J + 1
Else
If (CharByte <> 32) And (CharByte <> 10) And (CharByte <> 13) Then ' Skip spaces, LF and CR
CharByte = (CharByte - 48) And 31 ' And 31 makes it case insensitive
If CharByte > 16 Then
CharByte = CharByte - 7
End If
If Second Then
TXArray(J) = TXByte + CharByte
Second = False
J = J + 1
Else
TXByte = CharByte << 4
Second = True
End If
End If
End If
End If
Next
Try
COMPort.Write(TXArray, 0, J)
Catch ex As Exception
MsgBox(ex.Message & " Check CTS signal or set Flow Control to None.")
End Try
Else
MsgBox("COM port is closed. Please select a COM port")
End If
End Sub
|
|
|
|
|
Perhaps if you specify what it is about the code that you don't understand. I don't think that anyone wants to explain what every single line of the code does...
---
single minded; short sighted; long gone;
|
|
|
|
|
Some of the code is dealing with hexadecimal numbers that get received in ASCII and decoded.
The constants 32, 48, 10, 13 are space, zero, carriagereturn and linefeed, and should
not be there in numeric form at all.
The code is amateuristic and should not be taken as an example.
There is plenty of good code on CodeProject. Read some of the articles relevant to you.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I'm using crystal report 9 developer's edition and im using vb6. When i view the report in crystal viewer the report's lines, items are not in place. but when i print the report the lines and items are in place. i tried to remove and replace the crystal viewer but it is still the same. what can i do so that when i view the report the items are in place just like when i print it.
|
|
|
|
|
crystal report is just for view the page
u have to adjust the report page sequencially with proper order. cr is easy to support any language and easy print.
hope u understand
any problem mail me
lucky
|
|
|
|
|
I want to run my program in the background and be loaded by clicking on the exe file. I don't want to load a visible form. Would I do the console application or is there a different way to do this? My goal is to load my program for demo purposes. I want it to be transparent to the user. It will sit and listen a certain port. But, it has been a long time I looked into main procedures. And that was in C++. I searched using my subject and did not find any articles. Please help me if you can. Thanks.
Ex: instead of running my program and having frmLoad run. I want main to run and run my program until closed.
|
|
|
|
|
Cory Kimble wrote: Would I do the console application or is there a different way to do this?
No, a console application will produce a console window.
You could use a Windows forms application, but just don't instantiate the form.
Alternatively, you could create a windows service.
|
|
|
|
|
In Form Load
Me.Opacity = 0.0
Me.ShowInTaskbar = False
-Andrew
|
|
|
|
|
Folks, I want to declare a structure in C exactly into VB.NET. I had a problem dealing with the dimension of Char as I did not know how to declare them in VB.NET.
So can someone please give me the translated code for the structure below. Important aspect is that I will have to use the EXACT dimension to the Char array. The C structure is defined as shown below
typedef struct _IndexTransaction
{
TCHAR MsgDirPath[MAX_PATH];
DWORD dwMsgTime;
DWORD dwMsgSize;
TCHAR MsgEntryId[256];
TCHAR MsgFolderPath[256];
TCHAR MsgRecSet[32];
TCHAR MsgVolume[32];
} IndexTransaction, *pIndexTransaction;
Thanks in advance. Look forward for your responses.
Ravi
|
|
|
|