C# .NET - A project with an Output Tye of Class Library cannot be started. HELP!

Asked By Warjie Malibago
13-Jun-11 11:42 PM
this is my code in calling tha class library (which is now a .DLL) in my button click:

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

namespace ClassLibrary1

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

int fNum = Convert.ToInt32(textBox1.Text);

int sNum = Convert.ToInt32(textBox2.Text);

int ret = ClassLibrary1.Class1.Add(fNum, sNum);

}

}

}



but when i debug it,an error appears saying:

A project with an Output Tye of Class Library cannot be started.

it said that I should add an executable project to my solution,,but i don't know how to do that
  Riley K replied to Warjie Malibago
13-Jun-11 11:50 PM

You are the same guy that asked about how to create class library,

The project you use compiles into dll assembly and provide a set of classes with implemented functionality.

You should add to your solution new project with Output Type either Console Application or Windows Application (VS Add Project wizard will offer you different templates of Projects).

In newly added project you can implement logic to test your Class Library.

Output type of the project you can find and change by the following steps:

  1. Right click on project in Solution Explorer -> Properties.

  2. In opened tab with properties select Application and there will be ComboBox marked with Output Type label.

Thanks
  [ Kirtan ] replied to Warjie Malibago
14-Jun-11 12:35 AM
you have by mistaken set class file as Startup file in your project check start up file and set appropriate form as start up instead of class file / library



Error will be solved if you set it correctly
Create New Account
help
combobox i have one combobox and one textbox. . . . . . . . i filll value of combobox from database. . . . . . . . . . . . .i have to do that. . . . when i select combox value . . .the text of combobox selected value automatticaly display on textbox Hi, check this code which is working for me _selectedIndex As Integer Private _text As String Private Sub comboBox1_SelectedIndexChanged(sender As Object , e As EventArgs) ' Called when a new index is selected. _selectedIndex = comboBox1.SelectedIndex Display() End Sub Private Sub comboBox1_TextChanged(sender As Object , e As EventArgs) ' Called whenever text changes. _text = comboBox1.Text Display() End Sub Private Sub Display() Me .Text SelectedIndex: {1}" , _text, _selectedIndex) End Sub End Class when i use this code. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . the following error occurd "An unhandled exception of type 'System.StackOverflowException' occurred in System.Windows.Forms.dll" hi, As the error said, this exception is thrown when the execution stack overflows by having too many nested
Error in Combobox Hai Everyone, Error: possible unintended reference comparison; to get a value comparison cast the left handle side to type string. private void Mobile_cmbbox1_SelectedIndexChanged(object sender, EventArgs e) { if (Mobile_cmbbox1.SelectedItem = = "Samsung" ) { Connection(); da = new SqlDataAdapter("Select ModelNo From AddMobile where MobileName text property. Like, Mobile_cmbbox1 .SelectedValue.ToString() = = "use a value from db" Create New Account keywords: Error, in, Combobox description: Hai Everyone, font color = #ff0000span style = text-decoration: underline; strongError: / strong possible unintended reference
NRE opening combobox dropdown menu .NET Framework SWF DataGridView contains combobox control. Activating combobox and pressing F4 to open dropdown menu causes strange NRE (see below). When I enter some valid value to combobox, press tab, shift+tab , 44 dropdown menu opens OK. How to fix ? How to use source code to find the line in System.Windows.Forms.DataGridViewComboBoxCell.ComboBox_DropDown() which causes this error ? Andrus. System.NullReferenceException was unhandled Message = "Object reference not set to an instance of an object." Source = "System.Windows.Forms" StackTrace: at System.Windows.Forms.DataGridViewComboBoxCell.ComboBox_DropDown(Object sender, EventArgs e) at System.EventHandler.Invoke(Object sender EventArgs e) at System.Windows.Forms.ComboBox.OnDropDown(EventArgs e) at myApp.myComboBox.OnDropDown(EventArgs e) in myComboBox.cs:line 71 at
Validating Combobox Hello Everyone i am facing a problem on validating a combobox, i have a windows form which is having one combobox and 3 textboxes and and one button. . . when i click that button if there is no item selected from ComboBox. . i need show Error provider for that combobox, Can anyone tell me how to set error Provider for a combobox i tried Combobox validating event like private void comboBox1_Validating( object sender, CancelEventArgs e) { if (comboBox1
datagridview combobox selected index change event VB.NET hii I want to use the selected index change event of the datagridview combobox and i have use the following code for it:- Private Sub QcDtl1_EditingControlShowing( ByVal sender As e As System.Windows.Forms.DataGridViewEditingControlShowingEventArgs) Handles QcDtl1.EditingControlShowing If QcDtl1.CurrentCell.ColumnIndex = 5 Then comboBox = CType (e.Control, ComboBox) If (comboBox IsNot Nothing ) Then 'Add the event handler. AddHandler comboBox.SelectedIndexChanged, New EventHandler( AddressOf ComboBox_SelectedIndexChanged) gol = 1 End If but when i used the following code then it works fine for the first time but when i click the combobox again then it gives me an error, so i didn't understand the problem so please suggest me a way to resolve