|
Hi i am new to VB.NET. I want to develop an image gallery which consists of all kind of images. i want to show a thumbnail view for all the images. It consists of BMP,JPG,GIF,PSD,TIFF format. Is it possible to show PSD images in VB.NET if so how???
any help will be a great honour.
Thanks in advance.
Regards
Prasanna
|
|
|
|
|
I am migrating a large VB.6 solution to VB.Net and have encountered a problem that I haven't been able to solve.
It has been my habit for some years to notify myself of errors by putting up a new form and write to it the location and type of error that has occurred. This works nicely in VB.6.
I use this class in an error routine, such as.
Catch ex As Exception
Err.Showit("clsBars", "DoNewMinute", ex.Message.ToString)
End Try
In VB.Net the form comes up and is correctly sized and positioned and the error message is written to it.
When you pass the cursor over the form it turns to an hourglass. You can not minimize, maximize, close or drag the form.
If you use this class from a command button on another form with this code
Err.SetUpForm()
Err.Showit("This is a test")
the form behaves normally.
What am I missing?
Thanks
RCarey
Here is the code for my error class.(alias Err.)
Public Class clsError
Private dG As System.drawing.Graphics
Private dFt As System.Drawing.Font
Private dBr As SolidBrush
Private dFm As StringFormat
Private dX, dY As Integer
Private lineCount, maxLines As Double
Public Sub SetUpForm() '1/14/04
Dim dbgString As String
Try
frmError = New Form3 '<form3 is="" a="" ordinary="" form="" with="" no="" added="" objects
="" frmerror
="" .left="0
" .text="Errors"
="" .top="384
" .width="1000
" end="" with
="" frmerror.show()
="" catch="" ex="" as="" exception
="" dbgstring="ex.Message.ToString
" stop
="" try
="" dg="frmError.CreateGraphics
" dft="New" system.drawing.font("ariel",="" 7,="" fontstyle.regular)
="" dbr="New" solidbrush(color.black)
="" dfm="New" stringformat
="" dfm.formatflags="StringFormatFlags.MeasureTrailingSpaces
" maxlines="Math.Round(frmError.ClientSize.Height" dft.getheight)
="" sub
="" private="" sub="" clearform()="" '1="" 14="" 04
="" dim="" string
="" dg.clear(frmerror.backcolor)
="" linecount="0
" public="" overloads="" showit(byval="" instring="" string)="" if="" frmerror="" nothing="" then="" 'set="" up="" the="" form
="" setupform()
="" if
="">= maxLines Then
ClearForm()
End If
Catch ex As Exception
dbgString = ex.Message.ToString
Stop
End Try
Try
dX = 0
dG.DrawString(inString, dFt, dBr, dX, dY)
lineCount += 1
dY += dFt.Height
Catch ex As Exception
dbgString = ex.Message.ToString
Stop
End Try
End Sub
Public Overloads Sub Showit(ByVal inClass As String, ByVal inProcedure As String, ByVal message As String)
Dim dbgString As String
Try
If frmError Is Nothing Then 'set up the form
SetUpForm()
End If
Catch ex As Exception
dbgString = ex.Message.ToString
Stop
End Try
Try
dX = 0
dG.DrawString(inClass, dFt, dBr, dX, dY)
dX = 50
dG.DrawString(inProcedure, dFt, dBr, dX, dY)
dX = 200
dG.DrawString(message, dFt, dBr, dX, dY)
lineCount += 1
dY += dFt.Height
Catch ex As Exception
dbgString = ex.Message.ToString
Stop
End Try
End Sub
End Class
RCarey
|
|
|
|
|
I would like to show the .NET OpenFileDialog window after the MDI Parent Window is shown. This feature is available in the .NET IDE.
Tools/Options/Environment/General/AtStartup combobox.
Any ideas on how to code this feature?
Thanks,
Matt
.NetGuy
|
|
|
|
|
I got a problem here.
I need to link the microsoft excel to C++. The excel will act as a database for the coordinates..and i need to programme some commands for these coordinates like 3
Can C++ do this or should i use visual basic?
Thx alot
|
|
|
|
|
Goh Hui Beng wrote:
I got a problem here.
I need to link the microsoft excel to C++. The excel will act as a database for the coordinates..and i need to programme some commands for these coordinates like 3
Can C++ do this or should i use visual basic?
Thx alot
Hi, i have create a program using VB6.The purpose of this program are for sales department person key in the data and then review by manager.Now, my problem is manager want me to create a command button to export the data from microsoft access to excel.What is the command button code and the step? Another Question,this program must set up in the office and all the staff can see and use this program at their own PC's!Thank for ur help!
|
|
|
|
|
Hi,
I use crystal reports to show my reports @ my Winform. The procedure I do for this is...
Create a Crystal Report,
Create a Report Document,
Link the report document with the Crystal Report Viewer... as all described in the http://msdn.microsoft.com/msdnmag/issues/02/05/Crystal/default.aspx^, as in the server explorer section
But it reports the error as 'FAILED TO OPEN DATASET'..
Please help!!!
I was born intelligent Education ruined me!.
|
|
|
|
|
How can i get the shared folders of a remote system?
|
|
|
|
|
How can I map & disconnect network drives using vb.net?Pleas replyy soonnnn.....
|
|
|
|
|
How about using P/Invoke to call WNetAddConnection2 ?
|
|
|
|
|
Hi,
Does anybody knows how to get all driections and subdirectoires of a hdd?
I took a look at System.IO.IsolatedStorage, but I could not specify the hdd.
If someone has any ideas....
Thanks
|
|
|
|
|
Use the DirectoryInfo and FileInfo classes.
--Colin Mackay--
EuroCPian Spring 2004 Get Together[^]
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
|
|
|
|
|
Could you give me an example??
it will be very helpfull
Thanks in advance
|
|
|
|
|
|
Hi,
I have already seen some these web pages, but by problem is to look at all subdirectories, I am going to make a kind of loop over each directory. I hope that it help me.
Thanks, you helped me a lot too.
|
|
|
|
|
ltt19 wrote:
but by problem is to look at all subdirectories, I am going to make a kind of loop over each directory
That sounds about right. For each directory you then have to loop over the subdirectories, for each of the subdirectories you have to loop over the subdirectories, and so on...
--Colin Mackay--
EuroCPian Spring 2004 Get Together[^]
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
|
|
|
|
|
This code is for VB. VB.Net is quite similar though.
Set a reference to Microsoft Scripting Runtime
Dim srt As New Scripting.FileSystemObject
Dim drv As Drive
Dim fld As Folder
Dim f As File
Set drv = srt.Drives("C:\")
Set fld = drv.RootFolder
For Each f In fld.Files
Debug.Print f.Name
Next
If you want to loop through each directory as well you will need to create another function to return the folder object. To check to see if a folder has sub folder use the following code: fld.SubFolders
Michael
|
|
|
|
|
There are some classes in System.IO that do the same that you are doing. The problem is to loop over all directories with this classes. I will try to do a loop with your code.
Thanks again!!!
|
|
|
|
|
Here is something I wrote a few years back in VB6 to simple create a text file of all of my MP3s. It doesn't filter them by *.MP3 since that is all that is in that particular shared drive but you get the idea. I haven't had to mess around with the system.io yet. But the below does work. Give it a try.
Dim fso As New FileSystemObject
Dim List As TextStream
Const C_PLUS As String = "+ "
Dim i As Integer ' Indent
Private Sub Main()
Dim d As Folder
Set d = fso.GetFolder("N:\")
Set List = fso.CreateTextFile(d.Path & "NewSongList.txt", True)
DoFolders d
List.Close
End Sub
Private Sub DoFolders(fldr As Folder)
Dim d As Folder
If i = 0 Then
List.WriteLine Space(i) & C_PLUS & fldr.Path
Else
List.WriteLine Space(i) & C_PLUS & fldr.Name
End If
i = i + 2
DoFiles fldr
For Each d In fldr.SubFolders
DoFolders d
Next
i = i - 2
End Sub
Private Sub DoFiles(fldr As Folder)
Dim f As File
For Each f In fldr.Files
List.WriteLine Space(i + 2) & f.Name
Next
End Sub
Michael
|
|
|
|
|
Hi,
Yes, the idea is great, I am going to use your example, but I will try to use the system.io class, if I can´t, I will use your example as it is.....
Thanks, it is what I was looking for....
|
|
|
|
|
This is some code I have used. It writes all files in a directory and sub directories to an xml document. The functions are recusrsive. Modify to suite your needs as appropriate.
'Create a new xml textwriter and write to a stringwriter object
Dim sw As New StringWriter
Dim writer As New XmlTextWriter(sw)
'Write document element
writer.WriteStartElement("Files")
'Get the files here
ListFoldersAndFiles(Server.MapPath("MyFolder"), writer)
writer.WriteEndElement()
'Write end document element
'Clean up objects
writer.Flush()
writer.Close()
writer = Nothing
Dim xmldoc As New XmlDocument
xmldoc.LoadXml(sw.ToString())
Private Sub ListFoldersAndFiles(ByVal pth As String, ByRef writer As XmlTextWriter)
AddFiles(pth, writer)
AddFolders(pth, writer)
End Sub
Public Sub AddFiles(ByVal pth As String, ByRef writer As XmlTextWriter)
Dim sFiles() As String = Directory.GetFiles(pth)
Dim iFiles As Integer
For iFiles = 0 To UBound(sFiles)
writer.WriteStartElement("Files")
writer.WriteStartElement("Path")
writer.WriteString(pth)
writer.WriteEndElement()
writer.WriteStartElement("Filename")
writer.WriteString(Path.GetFileName(sFiles(iFiles)))
writer.WriteEndElement()
writer.WriteEndElement()
Next
End Sub
Public Sub AddFolders(ByVal pth As String, ByRef writer As XmlTextWriter)
Dim sDirectories() As String = Directory.GetDirectories(pth)
Dim iDirectories As Integer
Dim sDirectoryName As String
For iDirectories = 0 To UBound(sDirectories)
AddFolders(sDirectories(iDirectories), writer)
AddFiles(sDirectories(iDirectories), writer)
Next
End Sub
Jim
|
|
|
|
|
Hi, you are using XML, but the "idea" is the same, it could help me!!!, so I will try to do it with the System.IO classes, if not your code will be very usefull!
Thanks!
|
|
|
|
|
I did it, it works, for me, the code is above, if you want to make any changes...
Thanks for everybody who helped me.
Here is the code, using a ListBox named as 'lst'
Dim folders As New System.Collections.Specialized.StringCollection<br />
<br />
Private Function GetAllDirectories(ByVal Name As String)<br />
On Error Resume Next<br />
Dim finder As System.IO.Directory<br />
Dim cdir As New System.Collections.Specialized.StringCollection<br />
Dim cdir2 As New System.Collections.Specialized.StringCollection<br />
<br />
Dim cancel As Boolean = False<br />
Dim dir As String<br />
<br />
cdir.AddRange(finder.GetDirectories(Name))<br />
folders.AddRange(finder.GetDirectories(Name))<br />
<br />
Do While cancel = False<br />
<br />
For Each dir In cdir<br />
folders.AddRange(finder.GetDirectories(dir))<br />
cdir2.AddRange(finder.GetDirectories(dir))<br />
Next<br />
If cdir2.Count = 0 Then<br />
cdir = Nothing<br />
cdir2 = Nothing<br />
Dim i As Integer<br />
For i = 0 To folders.Count<br />
lst.Items.Add(folders(i).ToString)<br />
Next<br />
cancel = True<br />
Exit Do<br />
Else<br />
cdir.Clear()<br />
Dim y As Integer<br />
For y = 0 To cdir2.Count<br />
cdir.Add(cdir2(y))<br />
Next<br />
cdir2.Clear()<br />
dir = Nothing<br />
y = Nothing<br />
End If<br />
<br />
Loop<br />
<br />
MessageBox.Show(lst.Items.Count)<br />
End Function<br />
<br />
Private Function GetAllFiles()<br />
On error resume next<br />
Dim files As System.IO.Directory<br />
Dim dir As String<br />
For Each dir In folders<br />
lst.Items.AddRange(files.GetFiles(dir))<br />
Next<br />
End Function
|
|
|
|
|
|
I need help on how to use threading to close a form
|
|
|
|
|
Anonymous wrote:
I need help on how to use threading to close a form
I bit more information on the background would be helpful.
For instance. I don't know if you already have a second thread, or you want to launch a thread to close the form or what?
--Colin Mackay--
EuroCPian Spring 2004 Get Together[^]
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
|
|
|
|