|
Have you tried to solve the problem yourself?
I suggest that you go ahead and write some code. Google will throw up plenty of resources on treeview programming. If you have done that and are still experiencing difficulties, post again.
Paul
|
|
|
|
|
Thanks paul for ur reply.I tried to search on the net first and then I post my problem here.My treeview is working fine.Now I just want to know that how I can display the data on the base of treeview node selection.Either I need to run query every time to get the data from database on node selection or is this possible by storing the data in class and then just filter the data from class.
Any Idea how to store the data and then filter by providing criteria.
Thanks In advance
Ejaz
|
|
|
|
|
Handle the AfterSelect event to respond to node selection. The TreeViewEventArgs object supplied to the event handler has a Node property which will give you a reference to the selected node.
The TreeNode class exposes a Tag property which allows you to store any object data. You could consider creating your own data class to hold your associated and storing an object instance of it in this property for each node. It depends on how much data you need to associate with each node and how many items you are displaying in your TreeView. If the items/data are few, using the Tag property seems a good way to go. If the items/data are many, you may have to consider fetching the associated data from the database when a node is selected.
Regards
Paul
|
|
|
|
|
Hi,
Anyone know the code for a program to determine the screen size res etc so it can adjust the form size in runtime to fill the screen. Searching is not coming up with the goodies..
Thanks Heaps in advance.
|
|
|
|
|
The Screens class has all you need, but you can just maximise. Or are you worried about getting your form to lay itself out for the screen ? Then the anchor and dock properties of your controls are what you need.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Once again Christian your help has been most valuable
Many thanks
Frank
|
|
|
|
|
Dear All
I need your direction how to say an amount in words in visual absic.net program language, for the detail I will give an ilustration as follow:
I would like my program can automatically write 1,000,000.00 to be "one million and zero cent" in words.
Could any body from can help me ho to do that
Thank you for your help in advance
Best regards
ICE
|
|
|
|
|
That's the ubiquitous homework assignment. All you have to do is type "convert number to words" into Yahoo or Google and you'll come up with millions of hits.
|
|
|
|
|
Dave Kreskowiak wrote: ubiquitous homework assignment
I remember those kind of assignments from a long, long, long time ago
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
This is a common homework problem, I'm sure there's code to be found to do it. Essentially, you just parse the parts of the number and build your text representation of it.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Here's something i found, might help you.
<br />
=SpellNumber(32.50)<br />
<br />
<br />
Option Explicit<br />
<br />
'****************<br />
' Main Function *<br />
'****************<br />
Function SpellNumber(ByVal MyNumber)<br />
Dim Dollars, Cents, Temp<br />
Dim DecimalPlace, Count<br />
<br />
ReDim Place(9) As String<br />
Place(2) = " Thousand "<br />
Place(3) = " Million "<br />
Place(4) = " Billion "<br />
Place(5) = " Trillion "<br />
<br />
' String representation of amount<br />
MyNumber = Trim(Str(MyNumber))<br />
<br />
' Position of decimal place 0 if none<br />
DecimalPlace = InStr(MyNumber, ".")<br />
'Convert cents and set MyNumber to dollar amount<br />
If DecimalPlace > 0 Then<br />
Cents = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & "00", 2))<br />
MyNumber = Trim(Left(MyNumber, DecimalPlace - 1))<br />
End If<br />
<br />
Count = 1<br />
Do While MyNumber <> ""<br />
Temp = GetHundreds(Right(MyNumber, 3))<br />
If Temp <> "" Then Dollars = Temp & Place(Count) & Dollars<br />
If Len(MyNumber) > 3 Then<br />
MyNumber = Left(MyNumber, Len(MyNumber) - 3)<br />
Else<br />
MyNumber = ""<br />
End If<br />
Count = Count + 1<br />
Loop<br />
<br />
Select Case Dollars<br />
Case ""<br />
Dollars = "No Dollars"<br />
Case "One"<br />
Dollars = "One Dollar"<br />
Case Else<br />
Dollars = Dollars & " Dollars"<br />
End Select<br />
<br />
Select Case Cents<br />
Case ""<br />
Cents = " and No Cents"<br />
Case "One"<br />
Cents = " and One Cent"<br />
Case Else<br />
Cents = " and " & Cents & " Cents"<br />
End Select<br />
<br />
SpellNumber = Dollars & Cents<br />
End Function<br />
<br />
'*******************************************<br />
' Converts a number from 100-999 into text *<br />
'*******************************************<br />
Function GetHundreds(ByVal MyNumber)<br />
Dim Result As String<br />
<br />
If Val(MyNumber) = 0 Then Exit Function<br />
MyNumber = Right("000" & MyNumber, 3)<br />
<br />
'Convert the hundreds place<br />
If Mid(MyNumber, 1, 1) <> "0" Then<br />
Result = GetDigit(Mid(MyNumber, 1, 1)) & " Hundred "<br />
End If<br />
<br />
'Convert the tens and ones place<br />
If Mid(MyNumber, 2, 1) <> "0" Then<br />
Result = Result & GetTens(Mid(MyNumber, 2))<br />
Else<br />
Result = Result & GetDigit(Mid(MyNumber, 3))<br />
End If<br />
<br />
GetHundreds = Result<br />
End Function<br />
|
|
|
|
|
Wow. I'm unimpressed. You've managed to do all of his work for him, for an obvious homewrok assignment. Congratulations on helping him fail the class.
|
|
|
|
|
Sorry, I didn't mean it.All i wanted to do was help him...
|
|
|
|
|
The most valuable skill you can have as a developer is to know how to do your own research. You absolutely must be able to find out anything you need to to teach yourself anything from new techniques to entirely new technologies. Without that ability, you'd last about a year in a career writing code, if not any computer career.
There are three points to be made with every programming project in a class.
1. How do you logically break the problem down into smaller and smaller parts and code solutions to those small problems that work together.
2. How you manage your time to accomplish the task in the given time frame.
3. And how you do the research to teach yourself about the parts you're stuck on. This includes books, internet search engines and sites, and asking for help from appropriate resources by asking the proper questions.
Showing up on a site and asking for someone to hand over the entire source code is NOT the proper question. It just bypasses the other two points completely.
He really didn't ask for the source code, but he couldn't do point number 1 either. The answer he got pointed him in the correct direction to start doing his own research into the problem.
|
|
|
|
|
Thank you for your attention and your direction to me, I will trying to use of your valuable inforamtion
Thank you
ICE
|
|
|
|
|
There is an example right here on Code Project. It walks you through the entire process of creating the code so you know exactly what is going on and how it is built up. It also shows you how to test the code too (a skill far too few developers actually know how to do)
http://www.codeproject.com/cs/design/TestFirstDevelopment.asp[^]
|
|
|
|
|
How can I place a checkbox in a column of the Datagrid in VB6? like what datagridview in .net can do..
|
|
|
|
|
Hi,
The datagrid by default does not offer checkbox as a value for any of its cells. However I have created a work-around to get around this problem.
I have placed a checkbox on the form and when the grid loads the checkbox is moved to the cell. Code attached .
************
Private Sub Form_Load()
'on the form:
'one flexgrid (named= flex1)
'one checkbox (named= tb)
Dim intX As Integer
tb.Visible = False
With flex1
.Columns(0).Width = 2000
.RowHeight = 300
tb.Caption = "Box"
tb.Width = 500
tb.Move flex1.Left + 350, flex1.Top + 250, flex1.Width / 15, flex1.Height / 199
tb.BackColor = .BackColor
tb.Visible = True
End With
End Sub
************
Gary Bigman.
Software Engineer
ComponentOne LLC
www.componentone.com
|
|
|
|
|
I have a windows app that I deploy using ClickOnce. It is available on or off-line. Currently, as soon as the app is loaded it writes to the registry setting it up to use the Application.ExecutablePath to open any files with my file extention, and also sets a default icon. This seems to work partially, (well, not at all on vista machines, but that is another problem). The problem that I am encountering, is that if a user double clicks on a file with my extention, my program will launch but it doesn't do the check to make sure the user has the most up to date version of the program. This is an issue I could live with, but another problem is also occuring.
My program allows user to save preferences (for defaults, fonts, etc) in an XML file which I save at this location:
My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData
This file isn't found when the user launches the program by double clicking a file, but is found when the program is launched by the shortcut created during the ClickOnce installation.
I've seen a few other people with this problem and they were told to use URL parameters, but my users will only launch the program through an internet browser for the initial installation. After that they will use the shortcut or double click a file with my extention.
Does anyone know how I can use a ClickOnce deployment, but still get the FileAssociations to properly launch my program? I would appreciate any help or advice.
I program in VB.Net using Visual Studio 2005 on a computer running Windows XP.
|
|
|
|
|
Hi,
I recently started using VB2005 and i find it very confusing, in VB6 i used to unload form using UNLOAD ME but it doesn't work in 2005, plus i tried Me.Close() and Me.Dispose() as well but it closes my application, rather than form.
Here's the code i'm working on.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
Dim usname As String<br />
usname = StrConv(TextBox1.Text, VbStrConv.ProperCase)<br />
If usname = "Admin" And TextBox2.Text = "pass" Then<br />
MsgBox("Welcome to Form two", MsgBoxStyle.Information + MsgBoxStyle.OkOnly)<br />
Me.Close()<br />
Form2.Show()<br />
Else<br />
MsgBox("Wrong Login details", MsgBoxStyle.Exclamation + MsgBoxStyle.RetryCancel)<br />
If MsgBoxResult.Retry Then<br />
TextBox1.Text = ""<br />
TextBox2.Text = ""<br />
TextBox1.Focus()<br />
ElseIf MsgBoxResult.Cancel Then<br />
End<br />
End If<br />
End If<br />
End Sub
can someone please help me out with this...
Thanks.
Parth Patel
|
|
|
|
|
VB6 taught you some bad habits you have to break.
In VB6, all forms exist all the time. Under true OOP and VB.NET 2005, this is not the case. A form doesn't exist until your code creates an instance of it and shows it. Your code is then responsible for disposing of it when you're done with it. Forms are classes, just like any other class in the .NET Framework you create an instance of.
Putting a Me.Close in your startup form will close your entire application because you just killed off the form that's holding your application's message pump. A form should not kill itself off. The code that created and launched it normally would do this.
You cannot transfer control from one form to another like you're trying to do. Forms get created and destroyed in a tree-like fashion. Form1 creates Form2 and shows it, which may create Form3 and show it, which may create forms 4, 5, and 6. If the instance of Form2 dies, all the forms that it created and launched, and their child forms, die along with it.
The only thing you can do to not show your Form1 and give the illusion that Form2 is now the main form is to Me.Hide() .
In the case of a login form, there's a few different ways to do this. The first is to have a Sub Main launch the puts up a form and lets it check the credentials, then returns the login state to Main. Based on that result, Main then created a second form that is the main application form.
<STAThread()> _
Shared Sub Main()
Using loginForm As New MyLoginForm
Application.Run(loginForm)
If loginForm.DialogResult = Windows.Forms.DialogResult.OK Then
If loginForm.LoginSuccessful Then
Application.Run(New MyMainForm)
End If
End If
End Using
End Sub
Of course, LoginSuccessful would probably be a public property on the login form that this code checks to see if the credentials were good. It would probably also expose the credentials or some role information as a public property too.
|
|
|
|
|
Dave Kreskowiak wrote: <stathread()> _
Shared Sub Main()
Using loginForm As New MyLoginForm
Application.Run(loginForm)
If loginForm.DialogResult = Windows.Forms.DialogResult.OK Then
If loginForm.LoginSuccessful Then
Application.Run(New MyMainForm)
End If
End If
End Using
End Sub
Thank you very much for your help, but can you please tell me where do i put this code. I'm student learning so i don't really know much about Visual Basic.
Thanks
Parth Patel
|
|
|
|
|
Either in a Module (yuk!) or in your startup form's code. Then you go into your project properties and change the Startup item to Sub Main .
|
|
|
|
|
hi there,
can someone help me on how will i pass or copy (programmatically) the information inside or declared on the datagridview1 to datagridview2.
It's like on text box.. textbox1.text = textbox2.text
i just want the datagridview2 to have the data inside the datagridview1(through a mouse click) but without the use of any dataset coz it's not binded with the sql database.
can you show me codes.
i really can't figure it out eh..
thank you so much..;)
|
|
|
|
|
without trying it:
datagridview2.datasource = datagridview1.datasource
datagridview2.datamember = datagridview1.datamember
datagridview2.refresh
???
|
|
|
|