|
|
|
|
Imports System.IO
Dim strFileSize As String = ""
Dim di As New IO.DirectoryInfo("C:\temp")
Dim aryFi As IO.FileInfo() = di.GetFiles("*.txt")
Dim fi As IO.FileInfo
For Each fi In aryFi
strFileSize = (Math.Round(fi.Length / 1024)).ToString()
Console.WriteLine("File Name: {0}", fi.Name)
Console.WriteLine("File Full Name: {0}", fi.FullName)
Console.WriteLine("File Size (KB): {0}", strFileSize )
Console.WriteLine("File Extension: {0}", fi.Extension)
Console.WriteLine("Last Accessed: {0}", fi.LastAccessTime)
Console.WriteLine("Read Only: {0}", (fi.Attributes.ReadOnly = True).ToString)
Next
|
|
|
|
|
Hi,
I like to set the DataGridView-Rows height by the following ways...Is it possible?
DataGridView1.rows(0).height=30
DataGridView1.rows(1).height=50
DataGridView1.rows(2).height=20
But the above is not working while
DataGridViewRowHeaders.Visible =False
Thanks
|
|
|
|
|
Is the datagrid visible at the time you are setting this? I've had issues with trying to setup grids when they are not visible and it not working.
|
|
|
|
|
I didn't have any problems with this.
Starting with a DGV with a single row, containing a few columns, i ran this code;
Dim dgv As DataGridView = Me.DataGridView1
dgv.RowHeadersVisible = False
For i As Integer = 0 To 10
dgv.Rows.Add()
Next
For Each row As DataGridViewRow In dgv.Rows
row.Height = (row.Index * 10) + 10
row.Cells(0).Value = row.Height
Next
Dave
Find Me On: Web| Facebook| Twitter| LinkedIn
CPRepWatcher now available as Packaged Chrome Extension, visit my articles for link.
|
|
|
|
|
Hi Dave,
Thanks a lot. I learned many things from you....
Thanks Again, You have to live good !
|
|
|
|
|
Paramu1973 wrote: learned many things from you
So vote on the reply to show your appreciation.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi friends,
I have create reminder application without database so i am using XML.
i am new in XML.
Please give some example for read,write and append item in XML.
manipulation
-----------------------------------------------------------------
"Success is When Ur Signature Becomes An Autograph"
|
|
|
|
|
DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath("XML\\modules.xml"));
foreach (DataRow dr in ds.Tables[0].Rows)
{
btn.Text = dr["Display"].ToString();
}
try to use this code
|
|
|
|
|
See here[^] for the XmlDocument class which should do what you need.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
I'm currently looking into developing a GPS application for my company. I already understand how to read GPS NMEA messages however I'm not sure about how to develop the maps. These would be custom maps of factory sites and the like to help clients navigate. I'm trying to figure out the best way to save the map and how to update/move the map at the client moves around. I'm not someone to give me the code to do this, i realize that it is probably complicated. What I'm hoping is that someone has links to tutorials or other code that does something similar. I've been trying to search and have come up with very little. Any help would be greatly appreciated. Thanks in advanced.
|
|
|
|
|
The accuracy you get depends on the GPS device involved and its accuracy. You may well be sending your clients to a couple of hundred feet away.
But, if this is all you're doing, then you just need a rather large image of the site and the GPS coordinates of the four corners of the map. Then it's just a little math to map the clients GPS coords to the map to plot a point on the image.
|
|
|
|
|
I have this software developed through vb6 and its use text file. when run the program its read data from the text file, i need to encode this so that the text file cannot be change (add or delete data from it), i have download some encryption/decryption software with code but could not make it work with my application. Is there any way i can do this putting some decrypting module or code in my software so that the software could be secure.
Kindly help.
Thanks
Zela
|
|
|
|
|
No there is not....
There are two ways to solve your problem. The first is to encrypt the entire file, and decrypt the file when you want to read / edit it. Or you can encrypt the string of text which is contained by the file.
Have you read this[^] article? It will help you encrypt the entire file.
The article on this[^] page helps you encrypting and decrypting a string.
Hope it helps!
|
|
|
|
|
Im having an annoying little bug or glitch when i try to get data from a listview on the seconds tabpage of a tabcontrol.
Here's how you can replicate the issue, so follow these steps:
1. Create a Windows Forms application, using any Framework.
2. Place a tabcontrol. It comes with two tabs by default. Go into the second tab.
3. Place a listview on the second tabpage, add one collumn to the listview and set the HideSelection property to False.
4. Place a button on the form.
5. Put the following code in the Form_Load sub:
For i = 1 To 10
ListView1.Items.Add(i)
Next
Dim Rand As New Random
Dim int As Integer
For Each lvi As ListViewItem In ListView1.Items
int = Rand.Next(0, 2)
If int = 0 Then
lvi.Selected = False
Else
lvi.Selected = True
End If
Next
This will fill the listview with numbers 1 to 10. Then, it will randomly select/highlight some of those numbers.
6. Put the following code in the button's click event:
For Each SelLvi As ListViewItem In ListView1.SelectedItems
MessageBox.Show(SelLvi.Text)
Next
This will display all the selected/highlighted numbers in the listview in a messagebox.
7. Debug the program. We know that the listview had been filled with numbers 1 to 10 during form load, and that some of those are selected/highlighted. Now click the button. Nothing happens. No messagebox.
8. Click on the second tabpage. You can see that the listview contains items. Go back to the first tabpage, and click the button again. Now a messagebox pops up containing the selected/highlighted numbers.
See what the problem is? It seems you can only get the listview items once you've seen the contents of the second tabpage at least once. If you don't visit the second tabpage after starting the application, it won't work, you won't get a messagebox even though we know the listview has items and that some of those are selected/highlighted.
Anyone know a fix for this? In short: I need to get the selected/highlighted items from the listview on the second tabpage without having to visit/view the contents of the second tabpage first.
Virtual Space Shuttle Astronaut
|
|
|
|
|
A guess: the ListView hasn't been fully created yet. Add a statement:
Dim dummy as IntPtr=ListView1.Handle
maybe in your Form's constructor (or in the button click handler), to force the HWND to be created.
|
|
|
|
|
That looks like that did the trick!
I don't need to reference dummy somewhere?
Virtual Space Shuttle Astronaut
|
|
|
|
|
The Mighty Atom wrote: I don't need to reference dummy somewhere?
No, there isn't much you could do with it anyway. If you get a compiler warning, you might even get away with the simpler statement:
ListView1.Handle
which obtains the handle and forgets it right away.
|
|
|
|
|
Tried ListView1.Handle instead of Dim Dummy As IntPtr = ListView1.Handle but that produces an error:
Property access must assign to the property or use its value.
So i guess its Dim Dummy As IntPtr = ListView1.Handle after all, eh?
Virtual Space Shuttle Astronaut
modified on Monday, October 4, 2010 12:49 PM
|
|
|
|
|
Hey guys I am having trouble trying to remove and option from a ListBox. I can set settings easy but having a hard time trying to remove the selected item within the listbox.
Public Class Form1
'Load Settings
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
For Each item As String In My.Settings.lbCollection
lbView.Items.Add(item)
Next
End Sub
'Save settings when form closes
Private Sub Form1_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
My.Settings.Save()
End Sub
'Add settings when btn_Add" is clicked to listbox and settings
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If tbAddCollection.Text <> "" And lbView.Items.Contains(tbAddCollection.Text) = False Then
lbView.Items.Add(tbAddCollection.Text)
My.Settings.lbCollection.Add(tbAddCollection.Text)
End If
End Sub
'Display selected item in Textbox
Private Sub lbView_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lbView.SelectedIndexChanged
tbAddCollection.Text = lbView.SelectedItem
End Sub
'Remove selected item and its setting
Private Sub btnRemove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRemove.Click
If lbView.SelectedIndex <> -1 Then
lbView.Items.RemoveAt(lbView.SelectedIndex)
My.Settings.lbCollection.(lbView.SelectedItem)
End If
End Sub
End Class
Im completely lost =(
|
|
|
|
|
Herboren wrote: having a hard time trying to remove the selected item within the listbox.
You could start by explaining what you expect to happen and what does happen.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Well I understand that lbCollect(my listbox) is storing my settings in an array. While removing an entry from the list box I would also like to remove the entry from My.Settings or at least change its value to nothing or clear it so when I load my program again, it wont load that value into my list box. But I am not sure if that will screw things up, seeing how my settings were added to a string collection, parts of the string array would be empty.
Kindly as I stated in my previous statement, I would like to remove the selected list box item from My.Settings as well.
|
|
|
|
|
Your code snippet is incomplete. This line won't even compile (at the bottom or your code snippet) and there's no way to tell what you had in there:
My.Settings.lbCollection.(lbView.SelectedItem)
You also provide no explanation of what you expect to happen and what really does happen when you run this code.
|
|
|
|