|
A better method (object orientated etc.) would be to use IsInstanceOf e.g. to find out if MyObject implements the interface IMyInterface use the following code.
GetType(IMyInterface).IsInstanceOfType(MyObject)
|
|
|
|
|
Can anybody suggest a good way to display images in a directory? I would like to be able to display a small (thumbnail) view of the image and then click on the image to open it up in a PictureBox.
I’ve been trying to create a ‘Windows Explorer’ type setup where images in the directory that is open in a TreeView would be displayed as thumb nails. Since I’ve had no luck with that, I’m trying to re-group and find a different way to display the images.
Thanks
Brad
|
|
|
|
|
I suggest you use the Image Class provided by the .Net framework. It has a GetThumbnailImage method the you can use to display thumbnail images. Good Luck!
|
|
|
|
|
I have two listbox controls on the same form that I have populated using an arraylist created from an xml file. When I execute the form, the information appears in the list boxes as it should; however, when I make a selection in one of the list boxes, the selected value in the other changes.
Also, When I go to print out the selected values using:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Label3.Text = "Creating Test For " & ListBox1.SelectedValue _
& ":" & ListBox2.SelectedValue & ". Please Wait..."
Label3.Visible = True
End Sub
I get the selected value of the Listbox2 in both inserted places.
When I created these on the form I did not copy paste one from the other, I dragged two new listboxes onto the windows form.
Other things to note. I did populate the two listboxes using the same arraylist object after clearing it using:
xmlDoc.Load("../xml/BatchConfig.xml")
xmlNdList = xmlDoc.GetElementsByTagName("Unit")
For i = 0 To xmlNdList.Count - 1
arlAL.Add(xmlNdList.Item(i).Attributes("Id").Value)
Next
ListBox1.DataSource = arlAL
arlAL.Clear()
xmlNdList = xmlDoc.GetElementsByTagName("Phase")
For i = 0 To xmlNdList.Count - 1
arlAL.Add(xmlNdList.Item(i).Attributes("Id").Value)
Next
ListBox2.DataSource = arlAL
What gives?
|
|
|
|
|
What you did was bind ListBox1 to a datasource, then you cleared out that datasource and entered new information into it. So, yes, both istBoxes will have the same information behind them. The information from a datasource is not copied into the listbox, it is BOUND.
The solution is to create to diferent arrays and bind them to their respective listboxes.
'I'm assuming you Dim'd an ArrayList as arlAL...
Dim arlAL1 As New ArrayList()
Dim arlAL2 As New ArrayList()
xmlDoc.Load("../xml/BatchConfig.xml")
xmlNdList = xmlDoc.GetElementsByTagName("Unit")
For i = 0 To xmlNdList.Count - 1
arlAL1.Add(xmlNdList.Item(i).Attributes("Id").Value)
Next
ListBox1.DataSource = arlAL1
xmlNdList = xmlDoc.GetElementsByTagName("Phase")
For i = 0 To xmlNdList.Count - 1
arlAL2.Add(xmlNdList.Item(i).Attributes("Id").Value)
Next
ListBox2.DataSource = arlAL2
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Please help me ! Can you show me the codes that allow one to access the parallel port both the read and write operations by using visual basic.net programming
|
|
|
|
|
You can't do it directly because the O/S abstracts the hardware from software. You need a cute little driver to do the work for you. See http://www.logix4u.net/[^] for a good start.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi, thanks for ur reply. But, I found an information as below,
" To write data to LPT1, use the following code:
Success = WriteFile(hParallelPort, Buffer, Buffer.Length, BytesWritten, IntPtr.Zero)"
In this statement, the author didn't mention about the read operation. Do sir know it?
As sir reply,
is there compatible to implement in visual basic.net?
The dll file can use in vb.net?
All the code in that site can use in vb.net?
Thanks for your help, thank you very much!!!
|
|
|
|
|
I wrote a small program in VB6 where my mails should be sent to the recepient. But my program puts my mails in the outbox only. I have to go to outlook express then click on Send/Receive button then my mails go to sent items folder. But this is not the right way, I wanted my program to send the mails directly to the recepient. I used mapi controls for this program.
Is there any other i can do by making reference to COM component or by using any APIs.
plz, help me out.
Thanx,
Ravi.
|
|
|
|
|
check www.planetsourcecode.com[^]
select visual basic category then write smtp in the search box..
i've got many results this way.
|
|
|
|
|
I've written a DLL in VC6 (C++), and I think it's going to be used by a VB programmer. Knowing this ahead of time, I return variants from all exported functions.
I've tested the DLL with a C++ program, but I don't have VB installed and don't care to install it.
1) What do I need give the VB programmer in terms of info about the exported functions in the DLL?
2) Can someone here download and try the DLL in a VB program? If so, go here to download the DLL (includes the C++ test program source):
http://www.paddedwall.org/john/programmer/code/d3dlltest.zip
[EDIT] I correct the html link problem. [/EDIT]
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Helo, this is some problems occurs. Anyone can help?
1. How to get the current directory of the application.exe when I installed the application?
2. For "shell" command, if i am calling app.exe, do i need to specify the path?
3. How to make the close button to be hide button. I mean the close button that come with VB.Net is automatically function as close the form, i want to change it into hide button, which hide the form. How could i do that?
4. I have specified a form that the showintaskbar to false and the windowstate to minimized, but when i click the notify icon, which is set the showintaskbar to true and windowstate to normal, it only works for the showintaskbar, it doesn't work for windowstate. The form won't display unless i set to maximize. How can be like this?
Thanks...
Learning .NET
|
|
|
|
|
1. Use Environment.CurrentDirectory
2. "shell" command? Do you mean you are using the Process class to start an application?
3. Handle the Closing event on the form and set the Cancel property in the event arguments to true. Then you can provide your own behaviour.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
My Blog
|
|
|
|
|
2. It's usually a good practice to specify the full path to the app you want to launch. That way, you leave nothing to chance that the app can't be found.
3. Be careful how you implement this. If you just cancel the close event constantly, your app will never quit. This will stop Windows from restarting and shutting down. You'll have to override WndPrc and watch for the WM_ENDSESSION message. When you receive this message, you should set a flag in your code that is checked upon the Close event firing. This will tell you wheather or not you should really close your app or just minimize it.
4. This is normally because your window's normal state size is essentially 0 by 0. Try setting the size of the window to known values before you set it's state to normal.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
mythinky wrote:
3. How to make the close button to be hide button. I mean the close button that come with VB.Net is automatically function as close the form, i want to change it into hide button, which hide the form. How could i do that?
Adding the following to your form should do the trick:
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
Const WM_SYSCOMMAND As Integer = &H112
Const SC_CLOSE As Integer = &HF060
If m.Msg = WM_SYSCOMMAND AndAlso m.WParam.ToInt32 = SC_CLOSE Then
Me.Hide()
Exit Sub
End If
MyBase.WndProc(m)
End Sub
–Marty
|
|
|
|
|
Because my one-form-app doesn't end completely after invoking 'Unload Me': in fact, the form hides, but I can see the program still running in the task manager and I need it to finish completely.
I have a timer and i was wondering if this is the problem. I am sure i stop it before the form unloads (timer.Interval= 0), but i don't know if it needs a more 'explicit' stop.
Does anybody know how to close a VB application properly with Unload? Or does anybody know alternatives to Unload? Or does anybody know what's wrong with my timer?
|
|
|
|
|
Is this a VB6 or a VB.NET application?
|
|
|
|
|
|
By setting the Timer Interval to 0, just've told the Timer to fire it's event nearly continuously. You haven't disabled it. You need to set the Timer's Enabled property to False to turn it off. This is probably what's keeping your form open.
Also, the only event you can't reliably use Unload in is the Form_Load event. Anywhere else is fine.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi Guys...
Do any body knows how to create a socket that listen to all the incomming to a USB Bluetooth Dongle connected to my PC..??
Or how can i figure out the port number that dongle connected to..? All i know that is is connected to the "COM8" Port..!!
any ideas or simple code will b helpfull..!
thx
Hani M.Aql
|
|
|
|
|
Hi,
i try to insert values to a Access DB from VisualBasic .All the fields are TEXT datatype.For null values i assign vbNullChar(also i tried with vbNull).
Insert statement is:
con.Execute "Insert INTO " & TableName & " (" & tempFields & ") VALUES (" & tempInputs & ")", 1, 1
tempFields & tempInputs are arrays.
But some how the insert fails with the error:
Error :
Desc: "[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement."
Number : -2147217900
source : "Microsoft OLE DB Provider for ODBC Drivers"
Pls help
Ram
|
|
|
|
|
insert does not work with arrays.
create a command object
OR :
specify each field by its own like :
Insert INTO TableName (Filed1,Filed2,Filed3)<br />
values (val1,val2,val3)
and ignore nullable fields.
|
|
|
|
|
The best way to go about that is to create a command object with your SQL statement, but use parameters in the appropriate places.
Dim sqlString As String = "INSERT INTO MyTable (Field1, Field2, Field3) VALUES (?, ?, ?)"
Dim comm As New OleDbCommand(sqlString)
comm.Parameters.Add("@Field1Value", OleDbType.VarChar, 80).Value = somevalue
comm.Parameters.Add("@Field2Value", OleDbType.VarChar, 80).Value = somevalue
comm.Parameters.Add("@Field3Value", OleDbType.VarChar, 80).Value = OleDbType.Empty
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have some problems accessing a form when using a public sub in a module as startup object.
Module:
Friend frmMain as Friend
dim frm as new form1
frm.show
call Fill()
public sub Main
public sub Fill
frmmain.text = "ok"
end sub
In the form:
form1_load
frmmain = me
I am doing something/somethings wrong. I want to be able to reach this form after creating it like altering the caption in sub Fill. Any ideas how I do this?
thanks / Henrik
end sub
--- neteject.com - Internet Solutions ---
|
|
|
|
|
Well, the code you posted won't even compile. Try copying and pasting next time. The code frmMain = me doesn't do anything constructive at all. I don't know what you trying to do here.
First, when your Sub Main reaches the end, your app is going to quit. You have to give the form control to keep it's message pump running so your app won't quit. I assume you doing something in the Sub Main before displaying the form. This should take care of your problem.
Module Module1
Public Sub Main()
Dim myForm As New Form1
Fill(myForm)
Application.Run(myForm)
myForm.Dispose()
End Sub
Private Sub Fill(ByRef form As Form)
form.Text = "My Caption Text..."
End Sub
End Module
But, if this is all you wanted to do, then you would create a normal Windows Forms application and put this in the Form Load Event:
Me.Text ="My Caption Text..."
or change the appropriate properties in the Property Page in the Forms Designer.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|