|
I tend to do this with a ListBox; adding a line becomes (in C#):
lb.Items.Add(s);
lb.TopIndex=lb.Items.Count-1;
|
|
|
|
|
First the program i'm creating is to let users upload a file and placed it in a treeview.
I'm trying figure out how to take an uploaded text file from the form and place it in the treeview???
|
|
|
|
|
You'll have to open this file and read it yourself, parsing each line and taking appropriate action depending on how you want the treeview populated. There is nothing that will populate the treeview from any textfile automatically.
|
|
|
|
|
Ok, well I plan to rename the file by taking the file name that the users input into a textbox and placed that name in the treeview and when that node is click it should display the content of the file. Any other suggestion or examples would be greatly appreciated.
|
|
|
|
|
Than add the node to the TreeView where you want it and add put the full path to that file in the Tag property of the Node. Handle the NodeMouseClick event and get the Node that was clicked out of the event args. You can get the full path of the file out of the Tag event, and the rest is up to you.
|
|
|
|
|
I want to reuse some code this piece of code once:
<code> Try
If txt78.Text.Length = 0 Then
Call LabelCheck(78)
Else
If txt78.Text.Length <> 0 Then
Call UpdateMath(78)
If cm_intCompare78 <> txt78.Text Then
Call UpdateQuery(78)
If intCurrentCount >= 1000 Then
cm_intCompare78 = intCurrentCount - 1000
Else
cm_intCompare78 = intCurrentCount
End If
End If
End If
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try</code>
But the issue is that i have use this piece of code 14 times. What i would like to is something like this:
dim strTime as string
Try
If txt & strTime &.Text.Length = 0 Then
Call LabelCheck(strTime)
Else
If txt78.Text.Length <> 0 Then
Call UpdateMath(strTime)
If cm_intCompare & strTime <> txt & strTime &.Text Then
Call UpdateQuery(strTime)
If intCurrentCount >= 1000 Then
cm_intCompare & strTime = intCurrentCount - 1000
Else
cm_intCompare & strTime = intCurrentCount
End If
End If
End If
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
In thoery this should work but doesnot.. I have tryed to us string.concat but it doesnot work. Does anyone have any Ideas how i can do this?
Thank you
Shane
-- modified at 12:47 Wednesday 25th July, 2007
|
|
|
|
|
Since you are new, please read the forum guidelines. Your message titles need to have meaning. Using words like 'help' or 'urgent' may get your question ignored as we have had a rash of them lately.
_____________________________________________
Flea Market! It's just like...it's just like...A MINI-MALL!
|
|
|
|
|
Sorry, about that..i will read it more carefully next time..
Shane
|
|
|
|
|
Jeffrey Shane wrote: If txt & strTime &.Text.Length = 0 Then
This is not going to work.
So put this code into its own Sub and pass the textbox as a parameter to it, not the string in the textbox.
|
|
|
|
|
Pass the textbox & cm_intCompare as parameters into the function.
Example:
Public Sub Process(Byval txt as TextBox)
txt.Text = "Test"
End Sub
Mike Lasseter
|
|
|
|
|
Please help me
I 'm developping a vb.net application .I create with wizard connection to a Ms access database and i have created all the forms with datagrid , listboxes ... all bounded with tables in this dataset.
the problem is : Every month is created a new empty ms access database identical with the first one .This new month i want to connect the program with new databse and work with it .This procedure repeat every new month.
How to change the connection string at runtime from one database to another.
i repeat that databases are identical.
Thank you in advance !
|
|
|
|
|
mysybet123 wrote: Every month is created a new empty ms access database identical with the first one .This new month i want to connect the program with new databse and work with it .This procedure repeat every new month.
Doesn't sound like a very efficient thing to be doing.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
As Paul wrote, it does seem a little odd to be doing what you want to do. I'm sure you have your reasons.
A couple of options for you:
1. Your database name remains static, and when you launch the application in a new month, it renames your current database to something else, and creates/copies your blank database in its place. This way, you always connect to a database with the same name.
2. You declare a string variable (strMonth), and then have some code that decides which month you are in, and assigns a value to strMonth - so if you're in July, strMonth = "July". You then connect to strMonth, and not a specifically named file. An array of months might be an efficient method of doing this.
|
|
|
|
|
Thank you for your responses.
But there is a problem : there are 2 ore 3 users in network running this program and this users may work with different month database at the same time (these databases are located in one computer) .And i want to make possible that users can connect to the database they want.
( i have make this thing very easy in Ms Access but for some reasons i want to make a front-end in vb.net)
Someone tell me to change the My.Settings.Connection String but i don't know how to do it.
Thank you
|
|
|
|
|
Is the database structurally the same from month to month? I am still very bothered by the scheme of having a new database every month. If the structure is remaining the same, you can mark the records/rows based on what month it belongs to. This would get rid of having multiple databases and multiple connection strings...
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
Thank you !
The database structure is the same but the number and the size of records in a month is very large and if i take only one database after 2 ore 3 months the database size can reach the size limit of Ms Access database ( 2 Gb or i'm wrong !!!).
Now i'm thinking to connect in runtime and i think it's easy to change the database.
|
|
|
|
|
What kind of data are you going to be putting in the database to make it grow that large so fast?
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
I'm writing a program that copys a file, but if the targfetfile already exists i want a replace form, preferebly just like windows own. I've googled my a-s of to find such a thing, but no luck so far. I've made one by my own, but it's not as good as the original. Help would be appreciated.
|
|
|
|
|
No, there isn't. The best way to do it is to do what you've already done, create your own.
|
|
|
|
|
I have just installed Visual Studio 2005 on my machine and when I try to create a Web Project I get the following error message -
"Unable to create the Web...Could not find a Web Server."
My machine is running XP Pro and has Visual Studio 2003 previously installed, ASP.Net 2 is also installed.
2003 is working correctly and I can create a Web site with this.
I have set the ASP.Net version to 2 in the IIS properties.
Thanks
David
|
|
|
|
|
Have you had sure IIS is running?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
hi everyone
i want to have on my form my ip when i load it , i want it to be writen on a label
can someone help me to do that
thank you all
|
|
|
|
|
this should do the trick
Imports System<br />
Imports System.Net
Dim ipEntry As IPHostEntry = Dns.GetHostByName(My.Computer.Name)<br />
Dim IpAddr As IPAddress() = ipEntry.AddressList<br />
Dim i As Integer<br />
For i = 0 To IpAddr.Length - 1<br />
MessageBox.Show(IpAddr(i).ToString)<br />
Next i
hope it helps
|
|
|
|
|
|
hi... i am using vb.net 2003. i made a code to upload a file with the help of "file field control". everything is working fine but i just want to restrict the type of file type be uploaded i.e.i want the user to browse only for xls file. how this can be done??? thnx in ad
|
|
|
|