|
Thank you very much, Dave. I don't feel guilty now. Cheers.
Frank
|
|
|
|
|
I have a class with a ToString function ...
When want to show then string-representation of the object using MsgBox it works fine ... But when i use MessageBox i'll have a conversion-exception "Object can not be converted to a string" ... or somethinh like that.
Only way to make messagebox show text is using "MessageBox.Show(Convert.ToString(myObj))"
Why is this?
Can I get around it with some kind of manipulation of my Class?
//Maw
|
|
|
|
|
How are you using the MessageBox in code when you get the conversion exception?
|
|
|
|
|
Check out this small project : http://www.itaq.se/tostring.zip
I know that ListBox and some other controls goes for the .ToString by default. In this case it's an advanced conversion-question. I also want to assign a varibale like
"Dim MyVariable as string = MyObject" and MyVariable gets the string-representation of object.
In my project I implements IConvertible ...
Check it out ...
//Maw
|
|
|
|
|
<in form1="">
Dim frm2 As form2
Public Sub ClearProject()
frm2.TextBox1.Visible = False
frm2.Hide()
End Sub
<in form2="">
Dim frm1 As form1
Public Sub Button1_Click(Byval sender as System.Object,Byval e as EventArgs)Handles Button1.Click)
frm1.ClearProject()
End Sub
The codes look to be correct and simple enough, and I'm able to run the application as well. However, whenever i click the button in form2 to clear my project, there would be an error. Anyone know why?
|
|
|
|
|
What error? It's hard to determine the problem if you are not specific!
|
|
|
|
|
Chang
Dim frm2 As form2
To
Dim frm2 As New form2
MCAD
|
|
|
|
|
<in form1="">
Dim frm2 As form2
Public Sub ClearProject()
frm2.TextBox1.Visible = False
frm2.Hide()
|
|
|
|
|
Hi all,
i involved in HR project which scans the resumes and stores into the databse. i need to read the multiple files like,.doc,.pdf,.xls etc.that are already stored in database. I need to open the file based on the extension programatically.
Phanindra...
|
|
|
|
|
If you need to open them in the original application that wrote them, then all you need to do is retrieve the file out fo the database, save it to a temp folder, then launch that document using the Process class. It'll launch in whatever app is registered to handle that file extension.
If you need to parse that file yourself, you'll have to write individual parsers for each file type. It's trivial to determine what type that is, all you need to do is look at the last three characters in the filename to get the extension. Parsing those files is the hard part.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I paint the form on form_paint event. Form has some labels.when i paint the form, labels r still systemcolors.control colored. what can i do to force them changing theirs colors. The Transparency Background is not working on Desktop forms.
|
|
|
|
|
Hi All,
I'm doing some research on migrating existing vb6.0 appliation to vb.net. I would like to know what all tools available apart from migrate tool, which come along with .NET IDE, to upgrade vb6.0 application. Any suggestion/ Idea would be appreciated.
Regards,
Shiby
|
|
|
|
|
The migration tool in Visual Studio .NET is about the only thing there is. But, instead of putting up with the code that the conversion tool generates, I would highly suggest scraping the original project and just rewriting it from scratch.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi all,
searching the internet for printing/converting an Excel file into PDF let me to the following code.
Dim oXL As Excel.Application
Dim oWB As Excel.Workbook
Dim oSheet As Excel.Worksheet
Dim oRng As Excel.Range
' Start Excel and get Application object.
Set oXL = CreateObject("Excel.Application")
oXL.Visible = True
' do other things with the oSheet object
oSheet.PrintOut Copies:=1, ActivePrinter:="Adobe PDF on Ne01:"
but after some error messages I discovered that on my machine the ActivePrinter:="Adobe PDF on Ne01:" should rather have Ne02 in it.
Is there a programmatic way to find/set the correct ActivePrinter property on a machine. Adding a loop for "Ne0" + i doesn't look elegant.
thanx in advance
|
|
|
|
|
|
in my application i need to open the existing crystal report files, as in cyrstal report designer ( i need to edit/modify/add controls/formulas to the report). how can i do this ? any idea? please help.
Ninety-eight percent of the thrill comes from knowing that the thing you designed works, and works almost the way you expected it would. If that happens, part of you is in that machine.
|
|
|
|
|
Hi,
I ahve a listview control ( detailview with one column ). Say I have A .B and C items in the list.
Say when form loads A is selected by default.
Now user clicks on B. How can I know which item was selected before B got focus( or got selected ). Is there a even which is fired before click event of B would be fired?
This might clarify a bit.
When A is clicked , i populate a corressponding grid with some data.
Now user edits this data and dosn't hit save or anything. He clicks on B, now what I want to do is before the grid loads data for B ( the code for which is on click event ), i wanna read what's int eh grid for item A and save it, but how do i know which was the last selcted itedm before user switched?
Please help
This is visual studio 2003, vb.net, framework 1.1
|
|
|
|
|
You'd have to store this info seperately, because what comes back in viewstate is the current selection and before viewstate is loaded, there is no state at all.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Yeah this is what am doign currently, I thought there could be soemthing better.
Thank You thou.
|
|
|
|
|
OK, no worries. There isn't AFAIK any other way to do this.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi everyone,
I am using treeview directory structure in one of my applications. I need to display the count in a bracket next to each parentnode and child node, i.e., how many elements does one node have( count to be displayed , before & after collapse)
this is a part of my code to create a parent node
For each RowBranch in myDS.Tables("branch").Rows
Dim NewBranch As new Microsoft.Web.Ui.Webcontrols.TreeNode()
NewBranch.Text = RowBranch("braname")
NewBranch.Id = RowBranch("branchID")
NewBranch.Type = "Branch"
NewBranch.NavigateURL = "javascript:var win=window.open('branch_detail.aspx?ID=" & RowBranch("branchID") & "','','width=400,height=400')"
TreeView.Nodes.Add(NewBranch)
next to each branch (parent node) and dept(child node) i need to display a count of how many elements are present in that node. eg:
Presently it is:
+Adelaide ------Parent Node(branch)
|_
+Finance----------Child Node(dept)
I want it as :
+Adelaide (2)------i need to do this,(the count of no of child items inside)
|_
+Finance(25)----------i need to do this,(the count)
+Sales(20)
Need it urgently.Any help is well appreciated.Thanks a million
Aartee.
arty=me
|
|
|
|
|
Each node has a child nodes property. So use that to get a count, and append it to the text.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi Christian,
Thanks fo the prompt help, it is much appreciated but it will be great if you could explain it by an example or a few lins of respective code.
thanks a ton for all your help!
arty=me
|
|
|
|
|
private void LabelChildNodes(TreeNode node, bool recurse)
{
foreach(TreeNode child in node.Nodes)
{
string count = string.Format(" ({0})", child.Nodes.Count);
child.Text = child.Text + count;
if (recurse)
{
LabelChildNodes(child, recurse);
}
}
}
If you call this function with the first node in your tree view, like this:
LabelChildNodes(treeView1.Nodes[0], true);
you'll get that label all the way down. If you pass 'false', you get it just on the top level. You can also add code to check if the label is there already and remove it, or not show a label if the count is 0, anythign else you'd like.
Christian Graus - Microsoft MVP - C++
P.S. sorry, you'll have to turn this into VB, it's C#.
|
|
|
|
|
Hi again,
Looks like this solution will work excpet that I am getting the foll error:
"'Private Sub LabelChildNodes(TreeNode As Object)'."
I use Vb.net and I wrote your function as follows :
'************************************************************************<br />
Private Sub LabelChildNodes(TreeNode node, Boolean recurse)<br />
{<br />
Dim child As TreeNode<br />
For Each child In node.Nodes<br />
Dim count As String = String.Format(" ({0})",child.Nodes.Count)<br />
<br />
child.Text = child.Text + count<br />
<br />
if (recurse)<br />
{<br />
LabelChildNodes(child, recurse)<br />
}<br />
Next<br />
}<br />
<br />
End sub<br />
'************************************************************************
and called it here:
Function CreateTree(myDs as Dataset)<br />
<br />
'Create the Row Objects that are needed for the ForEach Loop<br />
Dim RowBranch as DataRow<br />
Dim RowDepartment as DataRow<br />
Dim RowPerson as DataRow<br />
<br />
'Run trough all Branches<br />
For each RowBranch in myDS.Tables("branch").Rows<br />
'Create a new TreeNode Object<br />
Dim NewBranch As new Microsoft.Web.Ui.Webcontrols.TreeNode()<br />
'Define a Text that is displayed for the new Node<br />
NewBranch.Text = RowBranch("braname")<br />
'Define a Id for the Node<br />
NewBranch.Id = RowBranch("branchID")<br />
'Give the Node a Tree Node Typ, so that the TreeNode Branch look different from department, Person<br />
NewBranch.Type = "Branch"<br />
'Define NavigateURL per Node, because new Page need the ID and retriev Data from the Database per ID<br />
NewBranch.NavigateURL = "javascript:var win=window.open('branch_detail.aspx?ID=" & RowBranch("branchID") & "','','width=400,height=400')"<br />
'Add the Node to the Tree<br />
TreeView.Nodes.Add(NewBranch)<br />
'treeview.nodes.add("key")<br />
---HERE--- LabelChildNodes(treeView.Nodes(0), True)<br />
<br />
'***********************************************************
Any further help?
Thanks a lot for prompt help, I am sure my manager will be happy at the end
aartee.
arty=me
|
|
|
|