|
10x bertburtbort
but the question is that what i really need , the combobox brings its data from database.
when a selected value in the comboBox then its details displayed in the dataGrid
actually the data in datagrid is brought from an other table in the database
that is what i need
10x again
|
|
|
|
|
If someone could show me how i can loop the following code until end of the text file.
This would be much appreciated.
Dim FileReader As System.IO.StreamReader
FileReader = My.Computer.FileSystem.OpenTextFileReader("C:\SBL.txt")
Dim StringReader As String
StringReader = FileReader.ReadLine
Form2.ListView1.Items.Add(StringReader)
|
|
|
|
|
StringReader is a strange name for a string ?
Anyhow, you use a while loop. your string will return null ( Nothing in VB ) when the file is empty. Or you can use ReadAllText to get the strings out as a string array and use for each to iterate over that.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Christian Graus wrote: StringReader is a strange name for a string ?
It's name is what it does, so i think that the name is relevant.
|
|
|
|
|
It's also the name of a class, I believe. It threw me for a second, that's all.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Christian Graus wrote: It's also the name of a class, I believe. It threw me for a second, that's all.
Hmm, will have to check into that THANKS
|
|
|
|
|
WestSideRailways wrote: It's name is what it does
No, actually it's not. The string object doesn't read anything. It only contains data that was read.
If you want to write less confusing code, you should name the variable after what it contains or what it's used for, not after what some part of the code does when it uses the variable. Also, variables are generally not named with the first letter in capital, to distinguish them from classes and methods, and using data types in variable names is generally discouraged.
---
single minded; short sighted; long gone;
|
|
|
|
|
|
WestSideRailways wrote: Then maybe it should be called StringHolder or StringContainer
It doesn't contain a string, it is a string. Well, actually it's a reference to a string, but that's implied as reference type variables always are references.
It contains a line of text. What's wrong will calling it "line"?
---
single minded; short sighted; long gone;
|
|
|
|
|
Do While Not FileReader.EndOfStream
StringReader = FileReader.ReadLine
Form2.Listview1.items.add(StringReader)
Loop
|
|
|
|
|
TwoFaced wrote: Do While Not FileReader.EndOfStream
StringReader = FileReader.ReadLine
Form2.Listview1.items.add(StringReader)
Loop
This works like a charm THANKS
Now for another question...
Is there any way to input horizonaly in a Listview box?
Or is this just a matter of Formatting?.
All my data is going down instead of across.
I am viewing the Listview Box with Details set as true and Columns Headers ready and waiting.
|
|
|
|
|
Yes, you would first add an item (the leftmost item). The 'Add' method returns a listviewitem so you can get a reference to it by writing this:
Dim item As ListViewItem = ListView1.Items.Add(StringReader) Then to add an item to the next column you would use this:
item.SubItems.Add(SubItem) That's basically what you need to know.
|
|
|
|
|
TwoFaced wrote: Then to add an item to the next column you would use this:
item.SubItems.Add(SubItem)
That's basically what you need to know.
THANKS Again
Have just been doing some more reading about Listview Boxs and have just figured out that what you have said is what i need to do.;)
|
|
|
|
|
This is my Code so far.....
Do While Not FileReader.EndOfStream
StringReader = FileReader.ReadLine
Form2.ListView1.Items.Add(StringReader)
'Adding Subitems
Dim item As ListViewItem = Form2.ListView1.Items.Add(StringReader)
Dim i As Integer
For i = 0 To 5
item.SubItems.Add(StringReader)
Next
Loop
Just a little bit of fine tuning....
What is happening is that the first item on the left is in the right spot, after that what should be the first sum-item it duplicated in the left column.
Then in the 3rd row this same item is in all the sub-item columns.
And the same thing happens to all the other sum-items, which then knoks out of wack all the other data.
It is surprising how writing something out and then thinking about it , you can come up with an answer;)
AND THE ANSWER is :-
move the Stringreader line into the for next loop and get rid of the line :-
Form2.ListView1.Items.Add(StringReader) as you don't need it twice in the code.
-- modified at 5:52 Monday 12th February, 2007
|
|
|
|
|
Can PDA support USB devices?? Such as fingerprint reader.
|
|
|
|
|
I doubt it, since it would probably be another drain on the battery. Check the specs on the one you're looking at. The bigger problem would be are there USB devices out there that support being attached to a PDA...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I am populating a windows form from btn but i want to hide the form the button is on, and when i close the existing form i bring back original form. hope this makes sense
Regards
big al
|
|
|
|
|
The easiest way to do this, is to write both forms as controls, put both controls on your one form, and change which control is visible. The other way, is just to set the initial form's Visible property to false when you open the form, and true when it's closed again.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
You could also consider setting the opacity of the form to 0% if hiding and re-showing the form causes problems wih Form_Activate if you are using it.
David Loring
!! Keep Music Live !!
|
|
|
|
|
so the form that needs to show when you close the other form place it like master form like startup form and then type this in load event in that form:
dim f as new form2()
me.hide()
f.showdialog()
me.show()
thats all...
but if you want to show form only if button is clicked then place on other form form2 one checkbox name it "chx" and type like this...
FORM 2
--------------------
public sub button1.click .... ' example button close form
chx.checked=true
me.close
end sub
public sub button2.click .... ' example button end program
chx.checked=false
me.close
end sub
-----------------------
FORM 1 STarting form
-----------------------
dim f as new form2()
me.hide()
f.showdialog()
if f.chx.checked=true then
me.show
else
end
end if
like that enyoj and hope it helps....
|
|
|
|
|
|
please describe wt u want
Lxcite's Planet
... the ultimate solution
|
|
|
|
|
Hari Om Prakash Sharma wrote: please describe wt u want
he described it up there ^ Hide Form & hiding form
|
|
|
|
|
Hi, Working with VB Net (2003) . How to highlight the Data Grid line when they are selected with a click from buttons First, Next, Previous, Last and is it possible also when I click in a cell from the same Data Grid to highlight the row. Thank you
|
|
|
|
|
Are you talking about a Windows Forms DataGrid or the Web Forms DataGrid?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|