|
Hey Dean,
I did what you suggested and it works very nicely and it doesn't lag at all. At least not with my Favorites folder and I have quite a few links in there. The only problem I have now is that I have only been able to read the complete url file text and there is too much garbage text to send it as a http: address. I have to find a way to extract only the url text and put that in the hidden column. Any ideas? Thanks
The text I get from the StreamReader is simular to this for every url file it reads, just the actual http:// text changes.
"[default]baseurl=http://www.adenak.com/[InternetShortcut]URL=http://www.adenak.com/Modified=1067F49A2E3BC50134"
Private Sub tvwExplorer_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles tvwExplorer.AfterSelect<br />
'Get reference to the selected node<br />
Dim dirInfo As DirectoryInfo = New DirectoryInfo(e.Node.FullPath)<br />
'Clear all the items in the listview<br />
lvwExplorer.Items.Clear()<br />
'Check if the Directory exist or not<br />
If (dirInfo.Exists) Then<br />
'Get reference to all the files<br />
Dim fileInfos As FileInfo() = dirInfo.GetFiles()<br />
'Add all the files to the ListView one by one<br />
Dim info As FileInfo<br />
For Each info In fileInfos<br />
'First check the extension, make sure it's a url file<br />
If info.Extension = ".url" Then<br />
Try<br />
'Open the file and read it<br />
'Convert the file path into a string for the StreamReader<br />
Dim infoPath As String = info.FullName<br />
' Create an instance of StreamReader to read from each file.<br />
Dim sr As StreamReader = New StreamReader(infoPath)<br />
'Read the complete url file text<br />
Dim url As String<br />
url = sr.ReadToEnd()<br />
'Extract only the url text<br />
<big>This is where I need to extract the http text</big><br />
<br />
Dim item As ListViewItem = New ListViewItem<br />
item = lvwExplorer.Items.Add(info.Name)<br />
' Link the ImageList object<br />
item.ImageIndex = 2<br />
'Add the items<br />
item.SubItems.Add(url.ToString())<br />
item.SubItems.Add(info.LastAccessTime.ToString())<br />
sr.Close()<br />
Catch ex As Exception<br />
'Ignor Exception<br />
Return<br />
End Try<br />
End If<br />
Next<br />
End If<br />
End Sub
-- modified at 19:43 Friday 24th February, 2006
|
|
|
|
|
Hey Dean,
I got it to work! Sorry but the Newbie is excited!!! lol I figured it out. I was reading the text wrong. I was reading the whole thing in one shot instead of reading it line by line and the 4th line I had to read it in two shots. This is the reading code I did and it all works just fine now. For anyone (Newbies) that need to know how to do this here's the extra code to finish it up. Change everything between the "Dim url As String" and the beginning of the listview code to this below.
'Read the url file and get the url text<br />
Dim c(3) As Char<br />
Dim url As String<br />
url = sr.ReadLine()<br />
url = sr.ReadLine()<br />
url = sr.ReadLine()<br />
url = sr.Read(c, 0, c.Length)<br />
url = sr.ReadLine()
Thanks again for all of your help Dean.
|
|
|
|
|
I have created a new instance of a form from a thread that responds to incoming UDP packets from another computer. This form shows up in the screen but the user cannot use it’s command buttons. Other threads cannot manipulate it’s variables or cause a paint event on it’s picture box.
How does one accomplish these things?
Thanks.
RCarey
|
|
|
|
|
Forms are not thread safe.
Because of this, I highly recommend that you display all of your forms on the same thread. If you need a separate thread to manipulate a form's contents, then look into using the BeginInvoke() method. See the below link for more details.
http://www.codeproject.com/csharp/begininvoke.asp[^]
|
|
|
|
|
I'm quite a vb.net beginner and I lost my library-card so I have to wait a month before I can get a book about this: How do I load a dll file into my vb.net program??
(I'm only 15 so I'm not very good at vb.net)
|
|
|
|
|
It depends what that dll file is! not all .dll files are the same thing, confusing I know!
So, if it is another dll written in .NET, then you just add a reference to the dll (are you using Visual Studio?)
If it is a COM dll, then you can still add a reference, and if using Visual Studio it will do the "hard work" for you.
If it is a windows dll then you often have to call them using pinvoke... this is a little complex if you are a beginner.... i hope its one of the above!
Hope that helps buddy, 15 is a good age to start learning to program!
|
|
|
|
|
Here is the link: http://r2.d2.hu/snf/sound_tools/freeware_gpl/free_bladeenc_encoder_player_editor_wav_mp3_ogg_rip_convert_encode_tracker.html
I only know how to use variables, load files, save files and some other basics :P
|
|
|
|
|
OK, so it looks like a COM dll to me, are you using Visual Studio to write your program?
|
|
|
|
|
nope visual express(it's .net by the way)
|
|
|
|
|
|
that's a great help
sorry but not really, none of the codes works
-- modified at 16:34 Thursday 23rd February, 2006
|
|
|
|
|
teuneboon,
What do you mean by it doesn't work?
I works in my vb.net...
Declare Auto Function MyMessageBox Lib "user32.dll" Alias _
"MessageBox" (ByVal hWnd As Integer, ByVal msg As String, _
ByVal Caption As String, ByVal Tpe As Integer) As Integer
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
MyMessageBox(0, "Hello World !!!", "Project Title", 0)
End Sub
progload
|
|
|
|
|
|
teuneboon,
hmmm... I guess i won't be able to help, It works here on mine just fine.
sorry,
progload
|
|
|
|
|
I now know how it works (I inserted the code in a form :S) but the call fuction doesn't work in my form when I want to call the class1 file
|
|
|
|
|
teuneboon,
If you want to put the Delcare Auto Function... in Class1 and then Call it from Form1, do this:
Change the line in your Form1 Button1_Click that reads:
MyMessageBox(0, "Hello World !!!", "Project Title", 0)
Change it to this:
Call Class1.MyMessageBox(0, "Hello World !!!", "Project Title", 0)
progload
|
|
|
|
|
ok now I know alot more about class and dll, thanks all
|
|
|
|
|
If you are talking about a Win32 API DLL, you do it like this:
Declare Function (or Sub) (FunctionName) Lib (Dllname) Alias (Function Name in DLL) then the arguments.
for instance:
Declare Function MsgBox Lib "user32.dll" _
Alias "MessageBox" (ByVal hWnd As Integer, _
ByVal txt As String, ByVal caption As String, _
ByVal Type As Integer) As Integer
Then you could call it like any other function.
There is more info about this here: http://kpdweb.cjb.net/
|
|
|
|
|
If you're using PInvoke, you probably want to check out www.pinvoke.net, they may have done the hard yards for you already.
I was 13 when I started coding. *sigh* That was in 1982.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
The early 80s were a good time to start coding.
It brings back the memories. My dad borrowed a Commodore Pet from work when I was 6. A friend had a Sinclair ZX81 and then my dad bought a ZX Spectrum in 1983.
ColinMackay.net
Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?
|
|
|
|
|
Yeah, I was aware of all those platforms. I learned on an Applle ][, only when I blew it up did I buy a C64, and then a slew of Amigas over the years. I often think if I'd not tried to build an NMI card, I'd be one of 50 people worldwide writing software for the Mac today.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hello...
Working with VS 2005 Final Release. I hava a DataGridView in which I would like the row to be highlighted a different color if the value in the row's "TAG" column is equal to the the text "NOTE_TEXT". All rows that have "NOTE_TEXT" as the value in the "TAG" column should be highlighted.
I know I can use the RowPrePaint event to do this but I am not sure how to determine which rows contain "NOTE_TEXT" in the "TAG" column within that event.
Here is the code for the event pulled from this page[^] (excellent article Btw... )
Private Sub dgvOne_RowPrePaint(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewRowPrePaintEventArgs) Handles dgvOne.RowPrePaint<br />
<br />
' Do not automatically paint the focus rectangle.<br />
e.PaintParts = e.PaintParts And Not DataGridViewPaintParts.Focus<br />
<br />
' Determine whether the cell should be painted with the <br />
' custom selection background.<br />
<br />
If (e.State And DataGridViewElementStates.Selected) = _<br />
DataGridViewElementStates.Selected Then<br />
<br />
' Calculate the bounds of the row.<br />
Dim rowBounds As New Rectangle( _<br />
Me.dgvOne.RowHeadersWidth, e.RowBounds.Top, _<br />
Me.dgvOne.Columns.GetColumnsWidth( _<br />
DataGridViewElementStates.Visible) - _<br />
Me.dgvOne.HorizontalScrollingOffset + 1, _<br />
e.RowBounds.Height)<br />
<br />
' Paint the custom selection background.<br />
Dim backbrush As New _<br />
System.Drawing.Drawing2D.LinearGradientBrush(rowBounds, _<br />
Me.dgvOne.DefaultCellStyle.SelectionBackColor, _<br />
e.InheritedRowStyle.ForeColor, _<br />
System.Drawing.Drawing2D.LinearGradientMode.Horizontal)<br />
Try<br />
e.Graphics.FillRectangle(backbrush, rowBounds)<br />
Finally<br />
backbrush.Dispose()<br />
End Try<br />
End If<br />
End Sub
I need to change this if statement:
If (e.State And DataGridViewElementStates.Selected) = _<br />
DataGridViewElementStates.Selected Then
so that it decides if the row being painted contains "NOTE_TEXT" in its "TAG" column.
Any ideas? This should be a fun one...
Many thanks!
"Half this game is ninety percent mental."
- Yogi Berra
If you can read thank a teacher, if you can read in English, thank a Marine.
|
|
|
|
|
i had the same situation but i did it in a much simpler way like this:
after binding the datagridview to datatable try this:
Dim i As Integer<br />
Dim font As New Font(DataGridView1.DefaultCellStyle.Font.FontFamily, 7, FontStyle.Bold)<br />
For i = 0 To DataGridView1.RowCount - 2<br />
Dim value As String<br />
value = DataGridView1.Rows(i).Cells("TAG").Value.ToString()<br />
If value = "NOTE_TEXT" Then<br />
DataGridView1.Rows(i).DefaultCellStyle.BackColor = Color.PeachPuff<br />
<br />
Try<br />
DataGridView1.Rows(i).DefaultCellStyle.Font = font<br />
Finally<br />
font.Dispose()<br />
End Try<br />
<br />
End If<br />
<br />
Next i
try it worked for me..
abhinav
|
|
|
|
|
|