|
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
|
|
|
|
|
arty=me wrote:
Looks like this solution will work excpet that I am getting the foll error:
"'Private Sub LabelChildNodes(TreeNode As Object)'."
What's the error ?
My code is for winforms, you're doing a web app ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
well, i did fix that problem, it was due to syntatctical differences in C# code and vb.net code .bu all sorted out now i get the foll error:
BC30213: Comma or ')' expected.<br />
<br />
Source Error:<br />
109: '************************************************************************<br />
Line 110: Sub LabelChildNodes(TreeNode node,recurse as Boolean)<br />
Line 111:
any idea whats happening?
and yes, i am doing a webapp and populating treenodes with values from database.
thanks a lot
aartee.
arty=me
|
|
|
|
|
arty=me wrote:
any idea whats happening?
arty=me wrote:
Sub LabelChildNodes(TreeNode node,recurse as Boolean)
node as TreeNode ?
arty=me wrote:
and yes, i am doing a webapp and populating treenodes with values from database.
I'm just wondering if the properties exposed by a web tree control will be the same as a Winforms one or not.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I am completely frustrated… Trying to help a friend.
Here is what I have been trying to do.. I am a noob at visual studio.
I am setting up an inventory database using VB as the front end. I have setup an accounts table, product table. These I can view edit, delete, and ad records to fine.
I am trying to make an invoice. I have set up the following tables:
tblInvoice
InvoiceNum Primary Key
AccountNum Foreign Key For Accounts table
Date
Total Total cost of items
tblInvDetails
Invoice Number Foreign Key from tblinvoice
QtyOrdered Number of Items ordered
Item description From Product table
Item price From Product Table
Total Cost QtyOrdered * Item Price
So far I have a form that I can get Account information filled in from accounts, date Picker, item selector, invoice number.
I can pick an item select quantity click a view button to view the following in textbox:
Invoice Num QtyOrdered Product Item Price total item cost
All is well with that here is where the problem comes. I want to create a button to add items to tblInvDetails.
Once I figure this out I will work on totaling the Total items cost and, updating the Tblinvoice info and printing an invoice.
I can not get past this until I figure out the update.
Please help…
|
|
|
|
|
DesertWrangler wrote:
I want to create a button to add items to tblInvDetails.
Where are you stuck ? Is it a table or a view ? I notice that it contains items 'from product table', surely this table would not contain that info, that would be insane. It should contain the ID from the product table so these things can be looked up.
If I were doing this, the button would bring up the product table so a product could be selected, then it would do the insert in the normal way, inserting the (known) invoice number, the quantity orderded, the product ID and the calculated price.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
The way I set it up is most likely going about it the hard way I am very new at this. Right now I have it were the Invdetail is in datagrid view. In another part ai have it were you can bring up an item by UPC, Item Number or Item name then input the quantity desired. I have a click button that them brings that with the to texts boxes. My though behind this is that you can change it befor adding it to the InvDetail table. I am now trying to get this to update to the invdetail.
Bottom line is I am trying to make an invoice that can be saved. I want the to bring up the account information for adrress, from the account table then add items fromthe product table. Calculate, update account, save and print or save invoice.
If there is an easy way I am all ears, cause this is driving me nuts.
Thanks
Russ
|
|
|
|
|
DesertWrangler wrote:
If there is an easy way I am all ears, cause this is driving me nuts.
Well, apart from the table changes I suggested ( based on what I think the tables look like ), it's just a simple insert command. Is that what you need help with ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Ya, I hav tried but I an not get it to work.
|
|
|
|
|
What's going wrong ? You obviously know how to write an insert statement, or you wouldn't have a database at all ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Assuming that your using a DataAdapter object to connect to your database and that there is an insert command setup the following code should work:
Try
Dim newrow As DataRow
newrow = MyDataSet.Tables("MyTable").NewRow()
MyDataSet.Tables("MyTable").Rows.Add(newrow)
BindingContext(MyDataSet, "MyTable").Position =
BindingContext(MyDataSet, "MyTable").Count - 1
Catch ex As Exception
MsgBox(ex.Message)
End Try
|
|
|
|
|
Hello all,
Doing my first application to transfer to PDA's. I've looked and looked but can't seem to figure out the 'standard' screen size for most PDA's in 'twips'. I'm not sure how big to make my forms. I realize this is a rookie question but hey, "it's my first day man". I've done the math conversion of what I believe to be screen size in inches, to pixels, to points to twips but every time I get a resultant size that looks too big.
This is one case where 'size matters'.
Thanks
Will
|
|
|
|
|
Hello there
I have an Xml file and I loaded it through Dataset. Now I have almost 8 tables. in any one of those tables I want to get the data in my required order like I have One table Name "Employee" I have two Fields name
"EmployeeAddress" and "EmployeeName". the data is arranged by default according to EmployeeAddress but I need it according to Employee Name. How I can do this. when I am not Using DataGrid .... Only using text boxes and user clicks next button to get the next record.
how to put "order by" clause in the loaded dataset table
|
|
|
|
|
if any one else has same problem then this is the solution
Dr = Ds.Tables("Employee").Select("","EmployeeName")
where dr = data row
|
|
|
|