|
I've made a much more simple example which also fails:
mObjExcel = New Excel.Application
mObjWorkBooks = mObjExcel.Workbooks
mObjWorkBook = mObjWorkBooks.Add
mObjSheets = mObjWorkBook.Worksheets
If mObjSheets.Count > 0 Then
For i As Integer = mObjSheets.Count To 2 Step -1
mObjSheet = mObjSheets.Item(i)
mObjSheet.Delete()
Next
mObjSheet = mObjSheets.Item(1)
Else
mObjSheet = mObjSheets.Add
End If
mObjSheet.Name = "A"
mObjSheet.Range("A1").Value = "1"
mObjSheet = mObjSheets.Add()
mObjSheet.Name = "B"
mObjSheet.Range("A1").Value = "1"
mObjSheet.Range("A2").Formula = "=SUM(A1;A!A1)"
This fails, but if I substitute the formula for =SUM(1+1) it writes correct.
The formula is taken directly from what Excel wrote when I made the SUM in there.
|
|
|
|
|
I found a workaround which only confirms my suspecision that it must be something culture specific issue.
I could instead of using a SUM formula add the cells together - and I was able to do this with the sheetnames in the addition, so instead of "SUM" I use "=SheetName!Cell+SheetName!Cell ...." and that looks to work when printed out as a .Value.
Wheee.
Thanks for the help otherwise
|
|
|
|
|
Hmmm...very weird. I wouldn't have thought that the culture would affect the sheetname.
|
|
|
|
|
I have no Excel automation experience, but maybe this idea could help:
you could enter the formula in Excel manually, then use automation to see how it looks...
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
The formula works, so that one is not a problem. I just can't generate the document automatically with this formula - but I can copy it into the document after generation where it would work.
---------------------------
127.0.0.1 - Sweet 127.0.0.1
|
|
|
|
|
I have a datagrid when i click on it at the starting of a row the whole row gets selected and the
datagrid.Columns(i).Text will give each column's text individually.
Even when i click on a perticular column of any row the text in that perticular column gets selected. can i get that perticular text at runtime.
i mean i want to get the text of the perticular cell(x,y) on which i click.
KIRAN PINJARLA
|
|
|
|
|
This code doesn't make sense because the DataGrid class (Windows Forms) doesn't have a Columns collection.
The ASP.NET DataGrid does have a Columns collection.
So which is it? The Windows Forms DataGrid or the ASP.NET (Web Forms) DataGrid in the .NET Framework 1.x (Visual Studio 2002 and 2003)?? Or are you really using the DataGridView class in the .NET 2.0 (Visual Studio 2005)?
|
|
|
|
|
Hi
I want to open a registry key for changing the owner , user has admin right
Dim User As String = Environment.UserDomainName & "\" & Environment.UserName
Dim K As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing", RegistryKeyPermissionCheck.Default, Security.AccessControl.RegistryRights.TakeOwnership)
Dim RS As Security.AccessControl.RegistrySecurity = K.GetAccessControl
Dim NTA As New Security.Principal.NTAccount(User)
RS.SetOwner(NTA)
K.SetAccessControl(RS)
But .NET throws an exception : Requested registry access is not allowed
I can open Regedit.exe and take registry key's owner ship , why this code doesn't work ?
|
|
|
|
|
You haven't opened the key with the appropriate access and permissions. You've opened it for Read, but not Write.
Try changing the OpenSubKey line to:
...LocalMachine.OpenSubKey("...", RegistryKeyPermissionCheck.ReadWriteSubTree, Security.AccessControl.RegistryRights.FullControl)
|
|
|
|
|
hi all
i am working on an website automation project.
on a web page their are some number of buttons
(value = "Modify" and type = "Submit")
each button opens another page but the url is as same as the current page.
i found that some hidden information also been sent. but the web page open when clicked on modify button the contents are different ( the page is used to modify the information in database )
their is a javascript function that invoke the submit method of the button being pressed.
How can i invoke that javascript functions in vb .net?
I'm using windows forms, webbrowser control (AxInterop.SHDocVw.dll)
i m trying to automate the work once done by the user ( such as downloading or uploading the files ( the addresses are specified in a file by the user), navigate to the pages as by the user in the same manner )
i have maintain a list of webpages visited by the user by picking up the myhtmldocument.url
but i have no idea how to send and get the information sent as post method.
any one have any idea about what should i read or anything else
thanks in advance
help everyone
|
|
|
|
|
read the bytes from the file.
you will find on google code.
good look
|
|
|
|
|
Hi all
Can any one tell me in my application i need to read a file from Pdf(file)
and write it into a text file. Can any one share the code pl. Pl mention the dll that we need for reference, I already added
IKVM.GNU.Classpath.dll
IKVM.Runtime.dll
PDFBox-0.7.2.dll
Regards
Prakash Mishra(Banglore,India)
|
|
|
|
|
Hi guys,
I'm having some problem with this. I'm writing a small tool that is supposed to parse out an HTML document and return my own implementation of an HtmlDocument class. I'm having a problem dealing with the way VS2005 formats an asp.net page by default (markup).
<body><br />
<div style="height: auto; width: auto; overflow: auto;"><br />
<table border="1" width="100%" style="height: 290%;"><br />
<tbody><br />
<tr><br />
<td style="width: 1%"><br />
</td><br />
<td><br />
<div style="width: 100%;"><br />
<iframe src="http://localhost/subtext/" style="height: 507px; width: 100%; overflow: hidden;<br />
vertical-align: top;" /><br />
</div><br />
</td><br />
<td style="width: 1%"><br />
</td><br />
</tr><br />
</tbody><br />
</table><br />
</div><br />
</body>
see the iframe tag? the Vertical-align attribute is shunted to a different line.
How would I rejoin it with its tag, in this case
TIA
<div class="ForumSig">There are 10 kinds of people in this world. Those who understand binary and those who don't...
______________________
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
</div>
|
|
|
|
|
There isn't sufficient information to answer your question, let alone understand what's your code is supposed to be doing.
Since CRLF's don't mean anything in HTML, I don't see this causing a problem with a browser.
Does your code parse this up and make a change to a line?? What does the code look like that splits and parses this?? What does the code look like that modifies this stuff and puts it back together??
Are you sure you're not looking at this in an editor, like Notepad, and have Word Wrap turned on??
|
|
|
|
|
Dear all
I would like to have your best favor due to my little bit matter, I have a report which is generated under crystal report, I want to print all report directly without see the report preview first through Crystal report program.
do you know any visual basic .net command that will instruct the program to print any report directly no need to see the crystal report print preview ?
Thank you
ICE
|
|
|
|
|
try this...
<br />
If PrintDialog.ShowDialog = Windows.Forms.DialogResult.OK Then<br />
reportDocumentObject.PrintOptions.PrinterName = PrintDialog.PrinterSettings.PrinterName<br />
reportDocumentObject.PrintToPrinter(PrintDialog.PrinterSettings.Copies, False, 1, 9999)<br />
End If<br />
Steve Jowett
-------------------------
Sometimes a man who deserves to be looked down upon because he is a fool, is only despised only because he is an 'I.T. Consultant'
|
|
|
|
|
I'm trying to insert the new date when a selected Product is being updated.
But I can't get it to insert the date.
Here is my code:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
BackColor="White" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px"
CellPadding="3" DataKeyNames="PartNumber" DataSourceID="SqlDataSource1" ForeColor="Black"
GridLines="Vertical" Width="700px"
AllowPaging="true" PageSize="18" AllowSorting="True" PagerSettings-Mode="NumericFirstLast">
<FooterStyle BackColor="#CCCCCC" />
<Columns>
<asp:BoundField DataField="PartNumber" HeaderText="Part Number" ReadOnly="True" SortExpression="partnumber" />
<asp:BoundField DataField="PartName" HeaderText="Part Name" SortExpression="partname" />
<asp:BoundField DataField="Picture" HeaderText="Image" SortExpression="image" />
<asp:TemplateField HeaderText="Original Price" SortExpression="Orgprice">
<EditItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Orgprice") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("Orgprice", "{0:C}") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Price" SortExpression="price">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("price") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("price", "{0:C}") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Description" HeaderText="Description" SortExpression="description" />
<asp:TemplateField HeaderText="Date" SortExpression="date">
<EditItemTemplate>
<asp:Label ID="DateTxt" runat="server" Text='<%# Eval("Date", Date.Now) %>' />
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="DateLabel" runat="server" Text='<%# Eval("Date") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
</Columns>
<SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="#CCCCCC" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:AeroModelConnectionString %>"
DeleteCommand="DELETE FROM [CloseOut] WHERE [PartNumber] = @PartNumber" InsertCommand="INSERT INTO [CloseOut] ([PartNumber], [PartName], [OrgPrice], [Price], [Description], [Picture], [Date]) VALUES (@PartNumber, @PartName, @OrgPrice, @Price, @Description, @Picture, @Date)"
SelectCommand="SELECT * FROM [CloseOut] ORDER BY [PartNumber]" UpdateCommand="UPDATE [CloseOut] SET [PartName] = @PartName, [OrgPrice] = @OrgPrice, [Price] = @Price, [Picture] = @Picture, [Description] = @Description, [Date] = @Date WHERE [PartNumber] = @PartNumber">
<DeleteParameters>
<asp:Parameter Name="PartNumber" Type="String" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="PartNumber" Type="String" />
<asp:Parameter Name="PartName" Type="String" />
<asp:Parameter Name="OrgPrice" Type="Decimal" />
<asp:Parameter Name="Price" Type="Decimal" />
<asp:Parameter Name="Picture" Type="String" />
<asp:Parameter Name="Description" Type="String" />
<asp:Parameter Name="Date" Type="dateTime" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="PartNumber" Type="String" />
<asp:Parameter Name="PartName" Type="String" />
<asp:Parameter Name="OrgPrice" Type="Decimal" />
<asp:Parameter Name="Price" Type="Decimal" />
<asp:Parameter Name="Picture" Type="String" />
<asp:Parameter Name="Description" Type="String" />
<asp:Parameter Name="Date" Type="dateTime" />
</InsertParameters>
</asp:SqlDataSource>
I appreciate any help and suggestion.
Thanks
|
|
|
|
|
There isn't a single line of VB.NET code in your post. I suggest trying this question in the ASP.NET forum.
|
|
|
|
|
Is there a way to find out what Com port are available on someones pc? I want to offer a dropdown list of those choices.
|
|
|
|
|
Hi Cory,
.NET offers the SerialPort.GetPortNames() method.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I'm not sure that's an appropriate title but I can't think of a better one. So far I have the image resizing with the line:
imageBmp = New Bitmap(imageBmp, New Size(imageWidth, imageHeight))
To me that feels sloppy, and so far I can't figure out a nice way to make a single like way to crop, and if I do I feel it will be just as bad. Am I on the wrong track? Am I just over worrying about something simple that won't save/waste processor time/power? Would it be better for me to do both at once (resize and crop) by making a second image and using DrawImage like in the code below (currently it just crops)?
imageNew As Bitmap = new Bitmap(Width, Height)<br />
imageNewGraphic As Graphics = Graphics.FromImage(imageNew)<br />
imageNewGraphic.DrawImage(imgBmp, new Rectangle(0, 0, Width, Height), X, Y, Width, Height, GraphicsUnit.Pixel)
I think I explained this well, I know there are other codes out there I could copy and I know that I'm reinventing the wheel, but I find I learn better this way. I'm very know to VB.NET but have had other programing training. Also this will be output to the web via ASP.NET using imageBmp.Save(Response.OutputStream , I don't believe that matters but I wanted to mention it anyway. Thanks for any help provided.
|
|
|
|
|
RX Maverick wrote: imageBmp = New Bitmap(imageBmp, New Size(imageWidth, imageHeight))
To me that feels sloppy
No, that's what you have to do.
RX Maverick wrote: and so far I can't figure out a nice way to make a single like way to crop,
I think you're asking if there is a "single LINE" way to crop an image. No, there isn't. You have to create a new bitmap the size you want the cropped image to be, then copy the bits from the old bitmap to the new one.
RX Maverick wrote: Would it be better for me to do both at once (resize and crop) by making a second image and using DrawImage like in the code below (currently it just crops)?
You could do it in one operation, but I wouldn't for right now. Get your app to work the way you want first, without worrying about wasting a ton of resources. If you're not constantly resizing and cropping an image, then this code should work just fine. It's one image operation. You're not really taxing the processor at all doing this.
|
|
|
|
|
Hi. I need to bind alistbox control to my table named genre. genre has a one-to-many relaionship with a table called song. What is happening is that I have bound my datagrid to table song. Table "song" has a column named genrename(foreign key) which also exists in the parent table "Genre" as a primary fey. I need my listbox to be able to select a genre for a specifc song(selected in the datagrid) and update the song tables genrename field for that song. If a user selects a genre all songs for a specific genre wil be listed then. please help
Mr Oizo
|
|
|
|
|
From your description, if I understand it, you're looking at two different situations.
The first is updating the Genre of a selected Song or multiple Songs. All you need to do is retrieve the Genre table's PK and Name columns and bind a ComboBox to that table. When the user selects something, the Combo's SelectedItem will fire, where you'll update the FK Genre column in the Songs table.
The second is if a ComboBox selection is made, all the Songs from the selected Genre should be returned.
This is two different operations, so I'd probably use two different ComboBox's to do this. One for searching and one for updating.
|
|
|
|
|
I have a datagridview on the same form. If I select a genre from the combobox it is meant to update the datgridview and the datagrid view then saves to the database. For some reason the value that it displays is "system.Data.datagridview" instead of the selected genre. I currently have set the datamember property to the dataset itself and the displaymember property to "genrename" the actual primary key and only field within the genre table(genre names need to be unique).Is this how to bind it or do i need to bind it somewhere else. Please help??? Mr Kreskowiak or anybody
Mr Oizo
|
|
|
|