|
I have to agree 100%. I was put on the task of looking into coding some custom sharepoint webparts for our company and after finding virtually no documentation on it we concluded it would be cheaper just to purchase some pre-made web parts.
|
|
|
|
|
Can a column in a DataTable have ArrayList as a type?
thanks
|
|
|
|
|
DataColumn.DataType supports only the base types in .NET. See the property documentation in the .NET Framework SDK for more information.
Besides, even if it could you would have problems getting/setting that from/in a database if you use a DataAdapter or anything, as well as displaying it in data-bound controls like the DataGrid , which would force you to implement your own DataGridColumnStyle making your DataSet and your data-bound controls tightly coupled.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
how do i load .tiff images into a document and print them.
i want to build the document first with all the images and just send the document to be printed
chad
|
|
|
|
|
If you're referring to a document format like Word documents, then you need to use the Office PIAs which providing printing methods.
If you want to create a conceptual document that merely holds a list of images, then it's a different story.
You could, for example, extend PrintDocument and add an ArrayList or something that contains images. In your print event overrides you need to not only enumerate those images (not in the handler, mind you, but keeping track of the position since the PrintPage event is called once per printed page) but determine whether or not one image will fit on a page in whole or in part. There are plenty of examples of this both on MSDN[^], CodeProject (I believe), and elsewhere on the web. It's really not difficult, though, you just have to keep track of state or decide to resize your images - or allow for both and use a user preference to determine which way to go.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
would this print out more the one copy of my image . if not what would i have to change
public string[] files=new string(2)
Private Sub printButton_Click(sender As Object, e As EventArgs)
Try
files[0]= "C:\My Folder\MyFile.bmp"
files[1]= "C:\My Folder\MyFile.bmp"
' Assumes the default printer.
Dim pd As New PrintDocument()
AddHandler pd.PrintPage, AddressOf Me.pd_PrintPage
pd.Print()
Catch ex As Exception
MessageBox.Show("An error occurred while printing", _
ex.ToString())
End Try
End Sub
' Specifies what happens when the PrintPage event is raised.
Private Sub pd_PrintPage(sender As Object, ev As PrintPageEventArgs)
' Draw a picture.
ev.Graphics.DrawImage(Image.FromFile(files[0]), _
ev.Graphics.VisibleClipBounds)
ev.HasMorePages = True
ev.Graphics.DrawImage(Image.FromFile(files[1]), _
ev.Graphics.VisibleClipBounds)
' Indicate that this is the last page to print.
ev.HasMorePages = False
End Sub
chad
|
|
|
|
|
You're trying to print both images to the same page and in the same position. As I mentioned, you must keep track of state so that you print only one image per page or print them in succession. As I also mentioned, PrintPage is fired once per page.
Also, this is the C# forum, not the VB.NET forum. You even mixed C# and VB.NET, which wouldn't work in the same source file (or even the same project if you're using VS.NET as opposed to command-line compiling with two modules in the same assembly).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
sorry about the vb.net and c# code mixed i copied and modified it from msdn to past it here i don't understand what you men keep track of state can you give me a code example i can't seem to find a print that uses more than one page
chad
|
|
|
|
|
Like the array index in between calls to your PrintPage event handler. Declare a field, like private int index = 0; . With each call to your PrintPage event handler, use that index to get the image in your array and then increment it so that with the next page to print you grab the next image, and so on.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
this is what i tryed and it still does not work
cntfiles is the current page i'm printing i att one to it on each call
pages is the total pages
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
System.IO.FileStream fs ; //create a filestream to open the image
fs= new FileStream(files[cntfiles],System.IO.FileMode.Open,System.IO.FileAccess.Read);
Image newImage = Image.FromStream(fs);
// Create Point for upper-left corner of image.
//Point ulCorner = new Point( 1, 1); //point to start image at
//e.Graphics.DrawImage(newImage, ulCorner);
e.Graphics.DrawImage(newImage, destRect);
fs.Close();
if(cntfiles
|
|
|
|
|
Hi All,
For my .NET C# windows application, I am building the installation setup using "Setup & Deployment" project. At the end of installtion it places a shortcut on users's desktop ( the way I want)
But the problem is if I want to specify some command line parameters I right click the shortcut--> go to properties, but what I see is "Target" as non-editable field.
So to specify some command line params I need to go to "Program Files"/"Appl Folder" and create a new shortcut to the excutable to specify command line params.
Any clues as to how I can set property such that at the end of installation the shortcut that installation places on desktop has editable "Target".
Thanks
Ruchi
|
|
|
|
|
This is because the Windows Installer projects in VS.NET suck. Trust me - I've worked with Windows Installer for as long as it's been out and the Visual Studio projects are always poor.
It is possible, just not using VS.NET. Good developer environments like Wise for Windows Installer[^] (cheaper, just as capable) and InstallShield Developer[^] (much more expensive, includes proprietary install projects, too) make this a trivial operation.
If you want to do this, you must Orca afterward and modify MSI tables directly.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
This property is set when you click the Next button in the folder selection dialog, which also has a radio button group with "Everyone" and "Only you" (or something like that) below the folder selection text box and button. If you want to default that to ALLUSERS = 2 then you'll have to use a tool like Orca (comes with the Windows Installer SDK) to put that property in the Property table.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks a ton. It works.
I have another question about setup project, but I will post it as separate thread.
Thanks alot
Ruchi
|
|
|
|
|
I need a listbox that contains a variable numbers of images in each row(Only images).
Is there an example of this somewhere, or should i use something else than a listbox?
Each row shall be sorted by the first image, second image, and so on.
Thanks
Thomas
|
|
|
|
|
I've never tried this, but it seems simple enough...
You could just put a panel on your form. Turn autoscroll to true and programatically add a picture box to the panel for each picture. If a picture box is off the panel scroll bars will appear (According to the panel documentation).
It may be more efficient to just draw your images to the panel rather than using the picture box, but I am not sure. If you do jsut try drawing the images you will probably have to manage the scroll bars.
|
|
|
|
|
I am inserting articles in a textbox. This is later displayed by id on a page. Since each article may include images etc. I need to be able to insert the html code along with the article content. How can i format my textbox so i can insert the contents into a table?
I get an error when i try to add the html tags.
error --->A potentially dangerous Request.Form value was detected from the client (txtbooktext="...LEASE:
|
|
|
|
|
got it working by adding to the top page directive ValidateRequest="false"
|
|
|
|
|
Not a good idea. See my post below.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
This really belongs in the ASP.NET forum, but I'll answer anyway.
ASP.NET checks for potentially dangerous content, such as HTML being passed back to the server because it could contain server-side script that would pose a security risk.
Instead, implement a bit of javascript that is executed before the form is submitted that will encode the HTML (i.e., changes things like < to <, etc.) and then submit it.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi all,
Our current applications use MFC Serialize to create our files, using the standard MFC rules.
The bosses that be wish our new .NET apps to read in these old files so we have an upgrade path for our users.
Is there an easy way to read in the MFC created file in a way much like the MFC Serialize function? i'd prefer not to have to read it in as a binary stream and work on it that way?
Any ideas?
Thanks
|
|
|
|
|
Runtime serialization definitely won't be any help since it is tied to Types. You can either read it in as a binary stream either with your app or through some convert app (which I know you don't want to do, but there's not a lot of choices) or develop an MC++ mixed-mode assembly that can - if possible - use your original MFC classes to deserialize the stream and construct managed classes from that data, which you can then serialize using Runtime Serialization. These classes could even be defined in a C# assembly if you want to create a conversion application.
Using MC++ would definitely be much easier since you can mix native and managed code, thus easily using your original MFC classes while also using managed classes from another assembly.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
The mixed mode assembly is a good idea, i'm not sure it would work for us though as we have a very large number of objects we would have to recreate, and we may end up referencing almost all of the MFC app which i know my boss won't like, but i'll certainly look into it though thanks.
Seems odd that MS didnt offer us something better than a binary stream but not quite runtime serialization?
|
|
|
|
|
If you want to deserialize your old MFC stream, then wouldn't that imply you plan on recreating many of these classes in C# anyway? Also, this MC++ could simply be a conversion program so that the old MFC classes aren't need to run your actual application which requires the deserialized stream.
MFC Serialization is specific to MFC while Runtime Serialization is specific to the Runtime. They work very differently and at the time MFC serialization was designed, something like XML was a pipe-dream. .NET can also use XML Serialization (more basic, but sometimes that's good) and Runtime Serialization using either the binary or SOAP formatters provided in the FCL, or any custom formatter you or someone else could create. It's a very extensible system.
The fact is that they both work very differently.
It would be possible to create, for example, an IFormatter class that could deserialize your MFC stream and maybe even stick with the same schema, but that's quite a bit of work and still requires that you handle the binary stream from your MFC app. If you upgrade to newer technology, change is inevitable or your force to design your app to the lowest common denominator - your old MFC app.
For this new application, you may wish to look at SOAP formatting using Runtime Serialization (more powerful), or simple XML Serialization. This will allow you to easily convert to something else in the future using the XML DOM or transforming it using XSLT. XML is around to stay for quite some time. While it's not always the most compact solution (see discussions on SOAP vs. Binary formatting across remote boundaries), it's definitely extensible.
For more information on these two alternatives, see XML and SOAP Serialization[^] in the .NET Framework SDK.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
The .NET application is heavily Xml based and we use Xslt heavily aswell, mainly for the reasons you have described.
The app will be structured better than our old MFC app as over the years (and programmers) its eaten way to many pies, but thinking about it more your idea of a MC++ app is probably the best option, that way we can get at MFC classes to get the data in then from the file and then convert it to an Xml doc that our new app likes, but by having it as a seperate tool we don't have to stick to the same class heirachy as the old app.
Thanks for the tip
|
|
|
|