|
A network, any network, is not a trusted source for executable code. I suggest you read up on Code Access Security[^]. And, what's new[^] for CAS in the .NET Framework 2.0.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I would like to build a datagrid from a directory of text files. How do I get the files from the directory into the datagrid?
Thank you,
Silver-grey
silver-gray
|
|
|
|
|
Why would you want to use such a heavy-weight control to display a list of filenames?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Because that is the User Specs. If you don't know a way to get the files in the directory and write them to another file name, Please don't comment. I thought that this was to help!! with the question:
silver-gray
|
|
|
|
|
Silver-Grey wrote: If you don't know a way to get the files in the directory and write them to another file name, Please don't comment.
OK, smart-ass...I just thought I would find out why the heavy wieght control needs to be used before I put the effort into commenting. Normally, a ListView is used for showing a list of filenames. Using a DataGrid for this is pretty odd, customer spec or no. I thought, "maybe this guy is a noobie and doesn't know any better. Let's find out first..."
Well, here's one way to do it...
Dim files As String() = Directory.GetFiles(directoryPath)
DataGridView1.Columns.Add( New DataGridViewTextBoxColumn() )
For Each f As String in files
Dim fa As String() = {f}
DataGridView1.Rows.Add(fa)
Next
This is probably not the best way to do it, but hey. I work out the specs with the customer and don't let them make the mistake of dictating them to me. You're supposed to work with the customer to come up with a proper solution, not for the customer.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I don't have a datagridview in tool box. Using 2003 Visual Studio
silver-gray
|
|
|
|
|
Great! More stuff I'm supposed to know without you explaining...
Let's see, my old .NET 1.x DataGrid is a bit rusty, but...
Dim files As String() = Directory.GetFiles(directoryPath)
Dim fa As New ArrayList()
fa.AddRange(files)
DataGrid1.DataSource = fa
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
That didn't work. I guess I will have to use a listbox. I can get data inti it. Now trying to select data out of it and write a new file with a different name.
Silver-grey
silver-gray
|
|
|
|
|
Could somebody tell me how to convert a string (0 to 255 range) to a byte array?
William
|
|
|
|
|
Use the encoding of your choise and the GetBytes method:
messageArray = Encoding.ASCII.GetBytes("Hello world")
---
b { font-weight: normal; }
|
|
|
|
|
Hi,
Thank you very much for help. Your code just works for ASCII characters. What about the characters in the range from 0 to 255??
Thank you again,
William
William
|
|
|
|
|
That's why I said that you should choose an encoding. Use the encoding that was used to create the string.
---
b { font-weight: normal; }
|
|
|
|
|
Dim textConverter As New System.Text.UTF8Encoding
Dim bytes() As Byte = textConverter.GetBytes("Text to convert")
Alexei Rodriguez
|
|
|
|
|
hii i am kannan.currently im working with a project in VB.Net. the project is, i've to create a reader for pdf files.the reader uploading a pdf file and user can read it like a real magazine. and we know we are flipping/turns each page of a real magazine to go for the next/Previous page. I WANT THE SAME PAGE FLIP EFFECT IN MY PROJECT.i heard that directx + vb.net wil gimme a solution.
you can see an example reader at www.zinio.com, its free for download. i need the same effect in my project. I have a components that converts each page of a pdf file to image file, which then i need to animate. Can you suggest me some idea. Is it possible using directx.
if anyone have experince in Directx + .net, lemme know it
|
|
|
|
|
Hi friends,
One problem i am stuck in please try to help.
I want to create a code where, when user clicks one row of the datagrid filled with data, the particular column value for e.g. the value of second column of the selected row should be visible on the text field present on the same form after a click of a button.
The sequence will be
1. First user click and selects one row
2. Then clicks a particular button
3. As click event is fired the value present in the second column of the selected row displays in the textbox present on the same form.
Try helping out please.
Nikhil Bandekar
Mumbai,
India
|
|
|
|
|
hi
is this windows or web application ??
Tamimi - Code
|
|
|
|
|
it is windows vb.net
i refered to the code u had given for hasan, regarding datagrid. I hope you would try to help me even. It seems you have good knowledge woking with datagrid
Nikhil Bandekar
Mumbai,
India
|
|
|
|
|
hi
put this line
TextBox1.Text = DataGrid1(DataGrid1.CurrentCell.RowNumber, 1)
on CurrentCellChanged event for thr datagrid or
on any button click
Tamimi - Code
|
|
|
|
|
hiii
Thanks a lots it worked out... I was struggling from when.
Thanks again for the favor.
Bye
Take Care
Nikhil Bandekar
Mumbai,
India
|
|
|
|
|
you are welcome
Tamimi - Code
|
|
|
|
|
I am looking to create a program similar to PcAnywhere so I can connect to various servers. I want to create an interface similar to theirs where it lists the servers that you have configured using a list view control. I want it to list the contents of the folder where I will save the configuration files and display the configuration information in the file for its respective columns.
|
|
|
|
|
That's great, do you have a question?
Mike Lasseter
|
|
|
|
|
Hi Guys
I was wondering if anyone could help me with code that loops through an application taking note of all the forms and controls that are present. Users can then dynamicall add validation rules that would be stored in a DB for example a user can select an orders form and then add a rule like specifying length of oreder number but this would be at runtime.
I want to avoid "hard coding" validations and allow users to set them up themselves.
There are 10 kinds of people in this world. Those that understand binary, and those that do not.
|
|
|
|
|
hellow to all ..
i am working on a listview and i am looking for a way to make an item on the listview not Visible , i didn't find how to do this ...
anyone have any idea ?
thxx
|
|
|
|
|
You could always set the column width equal to zero.
Mike Lasseter
|
|
|
|