|
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
|
|
|
|
|
Mr Oizo wrote: For some reason the value that it displays is "system.Data.datagridview" instead of the selected genre
And the code you're using that gets the value from the Combo would be ...??? Basically, what's causing that string to show up is that, somehow, your code is calling the ToString method on a DataGridView, instead of what you intended.
I get the feeling you're using all the designer generated stuff and not writing much, or any code, to do what you want?? I simply don't see that working.
Mr Oizo wrote: datamember property to the dataset itself and the displaymember property to "genrename"
I hope you really set the DataSource property to a DataTable, not a DataSet. A DataSet is a collection of DataTable objects and any DataRelations between those tables.
|
|
|
|
|
i use:
For i = 0 To dgSongProperties.Rows.Count - 1
If dgSongProperties.Rows(i).Selected = True Then
index = i
Call ShowCurrentSong(index)
End If
Next
Public sub showCurrentSong(index as integer)
' Other code for the various fields
' this code is to set the displayed values for a particular datgrid row in the various textboxes and combo boxes on the form (cmbGenre is the combo box)
If (dgSongProperties.Rows(index).Cells("Genre").Value) Is DBNull.Value Then
cmbGenre.SelectedText = ""
Else
cmbGenre.SelectedValue = CStr(dgSongProperties.Rows(index).Cells("Genre").Value.ToString)
End If
End sub
" i then have a sub called update datgird which works for allt he fields except genre at the moment(it displays system.data.dataviewrow instead of the selcted genre)
the code for the genre update for the datagrid is:
dgSongProperties.Rows(index).Cells("Genre").Value = cmbGenre.SelectedItem
(I have also tried cmbGenre.selectedvalue and also called the toString method.....None work)
The datasource for the combobox is dsLibrary.Genre
and for display member : dsLibrary.Genre.GenreName
What am I doing wrong here???????
I thought these tools were made to make life easy. Vb2003 seems easy compared to this. Please help
Mr Oizo
|
|
|
|
|
Mr Oizo wrote: dgSongProperties.Rows(index).Cells("Genre").Value = cmbGenre.SelectedItem
Take a look at the cmbGenre.SelectedItem part. What you think SelectedItem returns?? You're trying to use SelectedItem and SelectedValue interchangably. I can assure you they have very different purposes. Change SelectedItem to SelectedValue .
|
|
|
|
|
I changed it from selectedItem to selectedValue and it still doesn't work. Still displays "system.data.dataviewrow"
in this code i get an error message saying "Cannot set the SelectedValue in a ListControl with an empty ValueMember."
If (dgSongProperties.Rows(index).Cells("Genre").Value) Is DBNull.Value Or (dgSongProperties.Rows(index).Cells("Genre").Value) Is Nothing Then
cmbGenre.SelectedValue = ""
Else
"The error happens for the code below. "
cmbGenre.SelectedValue = CStr(dgSongProperties.Rows(index).Cells("Genre").Value)
End If
I have tried puttin genres in the song table in MS ACCESS so there is a value in dgSongproperties.Rows(index).cells("Genre").value but that still gives the error message.I want the value in the datagridview selected row genre to be the selected one in the genre combo box???
Mr Oizo
|
|
|
|
|
OK, this is really messed up.
Mr Oizo wrote: dgSongProperties.Rows(index).Cells("Genre").Value
You're getting the value out of the datagrid by an index?? Where's the index coming from?
Your posting single lines of code, but nothing around it, or what events these lines are in, so it's really difficult to get a hnadle on what your doing. We can go round and round with little bits of your code all month and still not get it fixed because it would take a code review to see what you did where and why. That simply isn't going to happen in a forum environment. (Don't even think of posting the entire project somewhere. I don have my own job to do and I have a life.)
|
|
|
|
|
Hi. The index was from a for loop that returns the index of the selected row in the datagridview. All I need is for the selected rows genre column value to be the value that is dislayed in the combobox. I am aware that you must be a busy man. Very sorry for bugging you but I'm just stuck with such a small thing
Mr Oizo
|
|
|
|
|
|
Well im using a loop so i can select that row index for updating(wasn't sure if there was another way, still a dumb student )
the loop is as follows:
For i = 0 To dgSongProperties.Rows.Count - 1
If dgSongProperties.Rows(i).Selected = True Then
index = i
Call ShowCurrentSong(index)
End If
Public sub ShowCurrentCong(index as integer)
'other code for the various fields (which works fine)
If (dgSongProperties.Rows(index).Cells("Genre").Value) Is DBNull.Value Or (dgSongProperties.Rows(index).Cells("Genre").Value) Is Nothing Then
cmbGenre.SelectedValue = ""
Else
'this is the problem code
cmbGenre.SelectedValue = CStr(dgSongProperties.Rows(index).Cells("Genre").Value)
End If
End sub
If you want me to stop asking you questions i will. I understand
Mr Oizo
|
|
|
|
|
We are developing a windows application that has several projects under one solution.
The problem we have run into is that we have connectionstrings in app.config files for each project.
We would like to have just one config file that all of the projects in the solution use.
Is there a way to do this or are there other ways that people normally handle this.
|
|
|
|
|
Hi,
Dim cfgMap As New ExeConfigurationFileMap
cfgMap.ExeConfigFilename = "MyConfigFile.exe.config"
cfg = ConfigurationManager.OpenMappedExeConfiguration(cfgMap, ConfigurationUserLevel.None)
For i As Integer = 0 To cfg.ConnectionStrings.ConnectionStrings.Count - 1
MsgBox(cfg.ConnectionStrings.ConnectionStrings(i).ConnectionString)
Next
Note: The type of extra applications in your solution is dll or exe?
Hope this helps
|
|
|
|
|
Pardon my ingorance but what should cfg be declared as ?
Thanks in advance...
|
|
|
|
|
You can find that out by looking at the return type of the ConfigurationManager.OpenMappedExeConfiguration method, which is Configuration out of the System.Configuration namespace.
|
|
|
|
|
Hi,
By default, when adding a folder to a C# project, it will affect the namespace of new classes contained there.
EG: Add a folder called dummy. then a class below, the IDE automatically inserts "namespace classlibrary1.dummy" into the class.
Is there anyway to turn this on in VB.Net?
|
|
|
|
|
No, there isn't. The VB.NET IDE does not support automatically add Namespace statements at any time.
|
|
|
|