Jump to content

How to include some .cs file in our project

- - - - -

  • Please log in to reply
8 replies to this topic

#1
Tonchi

Tonchi

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 471 posts
  • Location:Varaždin
  • Programming Language:C, C++, C#
I've found on the internet how to make my program to print my datagridview control during runtime...so i've download file of that print code and i need to include it in my project...how can i do it???

#2
gregwarner

gregwarner

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 853 posts
  • Location:Arkansas
Need to know a little more. Is the .cs file you downloaded a complete class which performs the above task? Or is it just a snippet of code that shows the technique?

If it's the former, just click on Add Existing Item from the Project menu and select the source file you downloaded. If it's the latter, just copy and paste into one of your source files and edit the variable names to match.

#3
Tonchi

Tonchi

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 471 posts
  • Location:Varaždin
  • Programming Language:C, C++, C#
it's from this page Another DataGridView Printer - CodeProject

#4
gregwarner

gregwarner

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 853 posts
  • Location:Arkansas
Yeah, all you have to do is save the .cs file somewhere in your project directory and use the Add Existing Item option I told you about. Be sure to note the namespace in the downloaded source file so you can reference it from your program.

#5
Tonchi

Tonchi

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 471 posts
  • Location:Varaždin
  • Programming Language:C, C++, C#
i read about including that file in pdf from that page...i know from source what i have to do...tnx a lot

#6
Tonchi

Tonchi

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 471 posts
  • Location:Varaždin
  • Programming Language:C, C++, C#
dgvprint.PageSettings.Landscape = True

this is for enabling landscape mode
how can i disable normal view of paper...opposite of landscape

#7
gregwarner

gregwarner

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 853 posts
  • Location:Arkansas
You mean portrait? I'm not sure how to do it with that specific class library, because I've never used it before. You'll have to consult the API documentation for their code to see if they've provided a method call or something to do that. If they haven't, you'll have to go in and modify the actual code of the class.

#8
Tonchi

Tonchi

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 471 posts
  • Location:Varaždin
  • Programming Language:C, C++, C#
what's meaning of that error


Error	1	The "GenerateResource" task failed unexpectedly.

System.Runtime.InteropServices.COMException (0x80070050): The file exists. (Exception from HRESULT: 0x80070050)

   at Microsoft.Build.Shared.NativeMethodsShared.InprocTracking.WriteContextTLogs(String intermediateDirectory, String tlogRootName)

   at Microsoft.Build.Utilities.FileTracker.WriteContextTLogs(String intermediateDirectory, String taskName)

   at Microsoft.Build.Tasks.GenerateResource.Execute()

   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()

   at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult)	EtsDtb




#9
gregwarner

gregwarner

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 853 posts
  • Location:Arkansas
Single step your code to find the line that's producing that error.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users