|
A google search for public domain icons will give you the results. These icons are in the public domain, so anybody can use them. They might put restrictions on them though - you may not be able to use them in commercial applications; however these restrictions are fairly few and far between
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
If you are using Microsoft Visual Studio 2005, you can find a compressed archive in this folder:
C:\Program Files\Microsoft Visual Studio 8\Common7\VS2005ImageLibrary
Extract the archive by using WinRAR or WinZip, then you can use everything, include icons in the extracted folder.
Do similar things with other versions of Microsoft Visual Studio .NET
Good luck!
chilinhhacker
|
|
|
|
|
Axialis has several sets of icons which should fit for most tasks:
http://www.axialis.com/free/icons/[^]
The icons are licensed under the Creative Commons Attribution License.
|
|
|
|
|
Hi
I have a class, that contains 13 functions, if i declare one among them as static.
While doing the calling of that static function, will it use memory until the application is closed.
Thanks
|
|
|
|
|
Weird question. why would it use memory ? ALL your code is in memory for the lifetime of the application. Any code that uses memory, static or not, will use memory when it runs. If it doesn't clean itself up properly, you have to close your eyes and pretend the GC will take care of it for you, but it probably won't.
memory usage is never a reason to not write a static method.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
vb does not have 'static' functions? Do you mean 'shared'? If so, the routine is available without declaring a new instance of the class it belongs to but the content of the routine is not allocated until called.
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
Hello everybody,
I hope someone can help me out with the right idea how to solve a listbox issue. The challenge is to change the color of listbox items depending upon a flag (TRUE if successfully processed). I tried to integrate several snippets already, but there's always something that makes it fail...
Ok.. some important information in advance:
- The listbox 'lstTargetFiles' is bound to a List (Of FileInfo).
- It shows the filenames of all the files in that list.
- Due to databinding issues I can't use a listview control.
For changing the color of successfully processed files in that list I owner-draw the listbox. The drawitem event works fine on initialization:
Private Sub lstTargetFiles_DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles lstTargetFiles.DrawItem
' Draw the background of the ListBox control for each item. Create a new Brush and
' initialize to a Black colored brush by default.
e.DrawBackground()
Dim myBrush As Brush = Brushes.Black
' Determine the color of the brush to draw each item based on the index of the item to draw.
Select Case e.Index
Case 0
myBrush = Brushes.Red
Case 1
myBrush = Brushes.Orange
Case 2
myBrush = Brushes.Purple
End Select
' Draw the current item text based on the current Font and the custom brush settings.
e.Graphics.DrawString((CType(sender, ListBox)).Items(e.Index).ToString(), e.Font, myBrush, e.Bounds, StringFormat.GenericDefault)
' If the ListBox has focus, draw a focus rectangle around the selected item.
e.DrawFocusRectangle()
End Sub This results in the first three items colored.
But how can reach my particular goal? Can I pass something like a flag or a user argument which could be triggered? I couldn't even find a way how to raise the event manually when the flag is true...
Thank you for your advice,
Michael
|
|
|
|
|
Meanwhile I found a workaround, but it's not very elegant so I just want to inform others about a working solution - and maybe inspire the gurus here to throw some of their 'cheap tricks' on me
What at least works is:
- I set the listbox's SelectionMode property to 'MultiExtended'
- After processing a file, I set its relevant listbox item to 'selected' in the same loop
Me.lstTargetFiles.SetSelected(Me.lstTargetFiles.Items.IndexOf(fileInfoItem), True)
- In the listbox's DrawItem event I (additionally) set the font for selected items to yellow
If e.State And DrawItemState.Selected Then myBrush = Brushes.Yellow
I'd really be interested in a more sophisticated approach, so please let me know if you have a better idea!
Thanks again
Michael
|
|
|
|
|
One thing that would work for this is to create a separate List (call it processedFilesList) derived from List(Of String) and then file paths/names would be added to that list when they are successfully processed, and removed if necessary when they change. In this new list Override the Add , Insert , Remove etc methods so that you can trigger an event when the list changes. Handle that event in your Form and trigger a repaint. In your lstTargetFiles_DrawItem include something like:
If processedFilesList.Contains((CType(sender, ListBox)).Items(e.Index).ToString())
myBrush = Brushes.Red
Else
myBrush = Brushes.Green
EndIf
Hope that helps.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
WOW - this one, Henry, sounds like an extremely smart and cool idea how to trick the limitation I faced.
Thank you in advance (without having tested it yet)
Michael
|
|
|
|
|
Hello all,I need some help here on reading specified column and row of data from the Excel Sheet. I have manage to read the full sheet into my datagridview now,but what I need is to read specified column and row but not all.I'll try to explain it like below:
Its a table in my excel that the table start at location in the PO Detail spreadsheet of A4 until G4. And thats the Header of the table,the Header name of each column are Product Code, Description , Internal Product Code, Selling Price , Order Quantity, Amount and other.
But currently my code now read all the data into my datagridview which is not convenient for me to do further process with some unuseful details inside the PO Detail excel sheet. Can anyone teach me how could you retrieve only the column and row I need and put into the datagridview?
This is the code I have currently which read everything into my datagridview:
<br />
Imports System.Data<br />
Imports System.Data.OleDb<br />
<br />
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
Dim MyConn As System.Data.OleDb.OleDbConnection<br />
Dim DtSet As System.Data.DataSet<br />
Dim MyCommand As System.Data.OleDb.OleDbDataAdapter<br />
<br />
Try<br />
MyConn = New System.Data.OleDb.OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0; Data Source='c:\OrderingFormat.xls'; Extended Properties=Excel 8.0;")<br />
MyCommand = New System.Data.OleDb.OleDbDataAdapter("select * from [PO Detail$] ", MyConn)<br />
MyCommand.TableMappings.Add("Table", "TestTable")<br />
DtSet = New System.Data.DataSet<br />
MyCommand.Fill(DtSet)<br />
DataGridView1.DataSource = DtSet.Tables(0)<br />
MyConn.Close()<br />
<br />
Catch ex As Exception<br />
<br />
End Try<br />
End Sub<br />
Thank you for reading and hope someone can give me some guidance on this issue.
Regards
Drex
|
|
|
|
|
You can use the names of the columns. This way:
SELECT ColName1,ColName2,ColName3 FROM [SheetName$]
|
|
|
|
|
I have tried it. It doesn't appeared anythings inside my Datagirdview with that. Shows that it return nothing,I'm using Excel 2003 format for my file. Do you have any idea to identify that the data table should retrive date from A4 to G4 as table header and A5 to G5 onwards are the data I need?
Thanks for your help.
Regards
Drex
|
|
|
|
|
Set HDR=YES in the connection string. Not sure though.
drexler_kk wrote: Do you have any idea to identify that the data table should retrive date from A4 to G4 as table header and A5 to G5 onwards are the data I need?
Through OleDB, no, apart from using column names. This can very well be done using Interop through Range object.
|
|
|
|
|
I tried it for you and it works well:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim MyConn As System.Data.OleDb.OleDbConnection
Dim DtSet As System.Data.DataSet
Dim MyCommand As System.Data.OleDb.OleDbDataAdapter
Try
MyConn = New System.Data.OleDb.OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0; Data Source='c:\1.xls'; Extended Properties=Excel 8.0;")
MyCommand = New System.Data.OleDb.OleDbDataAdapter("select Qty from [Sheet1$] ", MyConn)
MyCommand.TableMappings.Add("Table", "TestTable")
DtSet = New System.Data.DataSet
MyCommand.Fill(DtSet)
DataGridView1.DataSource = DtSet.Tables(0)
MyConn.Close()
Catch ex As Exception
End Try
End Sub
----------------------------------------------------------------------
For example
Excel FullFileName: C:\1.xls
In sheet1 add 3 columns (from A1 to A3):
A1=Qty A2=100 A3=250
B1=Prod B2=A B3=B
C1=ID C2=1 C2=2
I suggest you to do this simple example that works fine and after you get that this example works with no problem try to check where is your problem
Shay Noy
|
|
|
|
|
Well,I have try with this code as you suggest below:
<code> Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim MyConn As System.Data.OleDb.OleDbConnection
Dim DtSet As System.Data.DataSet
Dim MyCommand As System.Data.OleDb.OleDbDataAdapter
Try
MyConn = New System.Data.OleDb.OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0; Data Source='c:\TestPharmaExcel.xls'; Extended Properties=Excel 8.0;")
MyCommand = New System.Data.OleDb.OleDbDataAdapter("select Qty from [Sheet1$] ", MyConn)
MyCommand.TableMappings.Add("Table", "TestTable")
DtSet = New System.Data.DataSet
MyCommand.Fill(DtSet)
DataGridView1.DataSource = DtSet.Tables(0)
MyConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
And it promped me an error: No value given for one or more required parameter. What should I do to this?
Anyone can give me some idea?
Thanks for reading.
Regards
Drex
|
|
|
|
|
Iam using like the following
ExcelFile="C:\temp\My_test.xls"
Dim strConn As String = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" & ExcelFile & "; Extended Properties=""Excel 8.0; HDR=Yes; IMEX=1"""
Dim excelsheet As String = "[Sheet1$]"
Dim sql As String = "SELECT * FROM " & excelsheet
Try
Using cn As New OleDb.OleDbConnection
cn.ConnectionString = strConn
Dim da As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter(sql, cn)
cn.Open()
da.Fill(items)
cn.Close()
End Using
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
|
|
|
|
|
Sorry,I'm not going to read all the Sheet1 information into my datagirdview,because I doesn't need the additional data inside the sheet1. I would like to just retrieve the table data into my DataGridView. My 1st row header column for the table in my Excel sheet are A4:G4, the details of each row of data are from A5:G5. Can I know how to do this retrieving of data into my DataGridView?
Hope someone can guide me better. Thank you~!
Regards
Drex
|
|
|
|
|
At which line of code it gave you the error?
Shay Noy
modified on Sunday, July 12, 2009 6:55 AM
|
|
|
|
|
Well..The Error appeared at this line>> MyCommand.Fill(DtSet)
What might be the problem?
Thanks ~!
|
|
|
|
|
I made a simulation by changing the name of the Qty column in my excel file and I got the same error message as you got.
The problem is that you do not have a Qty column in your excel file.
You have to change the "Select Qty" in the query to "Select YourNameField"
Shay Noy
|
|
|
|
|
I do have a Qty column located at A3 cell here at Sheet1 actually. But I don't know why can cause this problem. My data is start at A4 column,I cannot put my Qty column to A1 because there is other data in A1 field in my Excel. Do you have any idea how should solve this problem?
Thanks
Regards
Drex
|
|
|
|
|
Have you got data in A1, A2 lines?
If yes you must leave those lines blank.
Try it and reply
Shay Noy
|
|
|
|
|
No,it was blank field for A1 and A2 field here actually. My table start with A3 actually. Do you have any other way beside this? Is that Interop can help to solve this problem? Do you have sample for using interops?
Thanks~!
Regards
Drex
|
|
|
|
|
I have another way, if you want, by linking the excel table to MS Access and then using access table to continue you project.
But, let's try to understand what you problem is.
If you want send me your excel file by email (helelark@gmail.com) and the button1 code too, I will check and re-send it to you.
Just tell me if you send it too me by email so I will check my email
Shay Noy
|
|
|
|