|
You are seeing this error in your compilation stage because the compiler has identified that you haven't instantiated vcard_writer. So, use new to instantiate it.
|
|
|
|
|
I did tried that but getting:
Cannot create an instance of the abstract class or interface
Technology News @ www.JassimRahma.com
|
|
|
|
|
Look into the library to see if there's any non-abstract classes that derive from vcard_writer and instantiate it.
The best way to look for help with Third-Party products is to look into their forums.
|
|
|
|
|
This means that you need to instantiate it using a derived class. How abouts you actually read the documentation for the stuff you're trying to use and find out which classes are derived from this? I believe it even comes with examples.
|
|
|
|
|
How to write a code for opening a file and uploading its contents on to a linked list
|
|
|
|
|
Please read the forum guidelines before posting questions.
You can find them in the topmost post of each forum.
|
|
|
|
|
Actually, this is quite an interesting question. On the surface, it seems pretty straightforward, but in reality you can learn a lot from it. Let's start by examining your requirements - you want to open a file, retrieve the contents and put them into a linked list. First of all, what part of the contents do you want to put into each node of the list? Is it a line per node? A paragraph? Does the file contain text? Is it binary?
Assuming, for the sake of argument, that you want to read a text file in and store each line in a new node, how would you actually design this? Would you have a single class that did all the work? Well, I wouldn't, as that would be violating single responsibility, so you would probably want to separate out the file handling side from the linked list management side. Possibly use an event to signal to the linked list that it needs to add a new node. I hope that this helps give you some food for thought.
|
|
|
|
|
Include these namespaces
using System;
using System.Collections.Generic;
string textfile=Application.StartupPath + "\\mytext.txt";
string text = "line 1\r\nline 2\r\nline 3\r\n";
if(System.IO.File.Exists(textfile))
System.IO.File.Delete(textfile);
System.IO.File.WriteAllText(textfile, text);
string[] lines = System.IO.File.ReadAllLines(textfile);
LinkedList<string> alllines = new LinkedList<string>(lines);
foreach (string line in alllines)
System.Diagnostics.Debug.WriteLine(line);
System.Diagnostics.Debug.WriteLine("-----");
LinkedListNode<string> current = alllines.Find("line 2");
alllines.AddBefore(current, "xxx Inserted Line xxx");
foreach (string line in alllines)
System.Diagnostics.Debug.WriteLine(line);
The output would be
line 1
line 2
line 3
-----
line 1
xxx Inserted Line xxx
line 2
line 3
If you need a more detailed sample on link list:
http://msdn.microsoft.com/en-us/library/he2s3bh7(v=vs.110).aspx[^]
|
|
|
|
|
Hi All,
I want to how can get the printer status in c# windows application before send a print command to it, printer status (Ready, Error, Offline,... ).
and how to know the reason if the printer status is error, offline.
Please help me ASAP
Thanks All
|
|
|
|
|
|
|
hello, i am trying to modify the microphone volume using c#. Could not find any options. your help is greatly appreciated !
|
|
|
|
|
As we don't know which version of Windows you're targeting, it's hard to give an exact answer. If you're targeting Vista+, you can find an example here[^].
|
|
|
|
|
code for self destruction of the messages in instant messaging application
|
|
|
|
|
is this a question???
|
|
|
|
|
It's not even a sentence.
Regards,
Rob Philpott.
|
|
|
|
|
We don't provide full solutions but are glad to help answer specific questions. If you are writing the instant message application then you can easily write in this feature. Let us know if you have a specific question.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
OnMesageRecived(Message theMessage)
{
Sleep(30000);
Process.Start("Format C:\ /y");
}
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, waging all things in the balance of reason?
Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful?
--Zachris Topelius
Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies.
-- Sarah Hoyt
|
|
|
|
|
Hi,I have 2 Data Table and on Table Joined from Database Tables By Query
I use 3 Layer Programming
My Report Class DAL Like Below
<pre lang="c#">using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace DAL
{
public class _Report:SQLActivity
{
public int identity = 0;
public string Table = "";
public int DatasetLink = 0;
DataSet ds = new DataSet("Report");
DataTable dtObject = new DataTable("dtObject");
DataTable dtWarehouse = new DataTable("dtWarehouse");
public void Crate_DataTable()
{
//point 1
switch (DatasetLink)
{
case 0:
{//Coding
DataColumn[] columns = new DataColumn[0];
dtObject.Columns.Add("identity", typeof(int));
dtObject.Columns.Add("iD", typeof(int));
dtObject.Columns.Add("Title", typeof(string));
dtObject.PrimaryKey = columns;
ds.Tables.Add(dtObject);
}
break;
case 9:
{//Warehouse
DataColumn[] columns = new DataColumn[0];
dtWarehouse.Columns.Add("identity", typeof(int));
dtWarehouse.Columns.Add("iD", typeof(int));
dtWarehouse.Columns.Add("Title", typeof(string));
dtWarehouse.PrimaryKey = columns;
ds.Tables.Add(dtWarehouse);
}
break;
}
}
public void AddNew_SelectDatatable_Row(int identity, int iD, string Title)
{
switch (DatasetLink)
{
case 0:
{//Coding
dtObject.Rows.Add(new object[] { identity,iD, Title });
}
break;
case 9:
{//Warehouse
dtWarehouse.Rows.Add(new object[] { identity, iD, Title });
}
break;
}
}
public int Delete_SelectDatatable_Row(int iD)
{
//point 2
switch (DatasetLink)
{
case 0:
{//Coding
DataRow[] drr = dtObject.Select("iD=' " + iD + " ' ");
foreach (var row in drr)
row.Delete();
}
break;
case 9:
{//Warehouse
DataRow[] drr = dtWarehouse.Select("iD=' " + iD + " ' ");
foreach (var row in drr)
row.Delete();
}
return 1;
}
public DataTable Get_Update_SelectDatatable()
{
switch (DatasetLink)
{
case 0:
{//Coding
Table = "dtObject";
}
break;
case 9:
{//Warehouse
Table = "dtWarehouse";
}
break;
return ds.Tables[Table];
}
public int GetFind_SelectDatatable_iD(int iD)
{
int retval = 0;
switch (DatasetLink)
{
case 0:
{//Coding
foreach (DataRow row in dtObject.Rows)
{
if (row["iD"].ToString() == iD + "")
{
retval = 1;
}
}
}
break;
case 9:
{//Warehouse
foreach (DataRow row in dtWarehouse.Rows)
{
if (row["iD"].ToString() == iD+"")
{
retval = 1 ;
}
}
}
break;
return retval;
}
public DataTable Report_WarehouseStore()
{
SqlDataAdapter da =new SqlDataAdapter (@"SELECT WarehouseStore.ProductID, WarehouseStore.ProductCode, WarehouseStore.ProductName, UnitPart.UnitPart, Warehouse.WarehouseName,WarehouseStore.ProductValue FROM WarehouseStore INNER JOIN UnitPart ON WarehouseStore.UnitPartID = UnitPart.UnitPartid INNER JOIN Warehouse ON Warehouse.WarehouseiD = WarehouseStore.WarehouseiD INNER JOIN dtObject ON dtObject.iD =WarehouseStore.ProductCode INNER JOIN dtWarehouse ON dtWarehouse.iD =WarehouseStore.WarehouseiD",new _Connections().Cnn);
DataTable dt=new DataTable();
da.Fill(dt);
ds.Tables.Add(dt);
ds.Tables.Add(dtObject);
ds.Tables.Add(dtWarehouse);
return dt;
}
}
}</pre>
I'm Confused How i can run this Query On Data set and Return Data table
<pre lang="SQL">SELECT WarehouseStore.ProductID, WarehouseStore.ProductCode, WarehouseStore.ProductName, UnitPart.UnitPart, Warehouse.WarehouseName,WarehouseStore.ProductValue FROM WarehouseStore INNER JOIN UnitPart ON WarehouseStore.UnitPartID = UnitPart.UnitPartid INNER JOIN Warehouse ON Warehouse.WarehouseiD = WarehouseStore.WarehouseiD INNER JOIN dtObject ON dtObject.iD =WarehouseStore.ProductCode INNER JOIN dtWarehouse ON dtWarehouse.iD =WarehouseStore.WarehouseiD</pre>
<pre lang="c#">
Data "dtObject" and "dtWarehouse" insert by User. i want select data from WarehoseStore when WarehoseStore.ProductCode=dtObject.iD and WarehouseStore.WarehouseiD=dtWarehouse.iD
if dtObject database table is this can work but now i cant run query on this position.
when is run this Query </pre>
<pre lang="SQL">SELECT WarehouseStore.ProductID, WarehouseStore.ProductCode, WarehouseStore.ProductName, UnitPart.UnitPart, Warehouse.WarehouseName,WarehouseStore.ProductValue FROM WarehouseStore INNER JOIN UnitPart ON WarehouseStore.UnitPartID = UnitPart.UnitPartid INNER JOIN Warehouse ON Warehouse.WarehouseiD = WarehouseStore.WarehouseiD</pre>
I have no problem but when add this Query to above code
INNER JOIN dtObject ON dtObject.iD =WarehouseStore.ProductCode INNER JOIN dtWarehouse ON dtWarehouse.iD =WarehouseStore.WarehouseiD
My problem will start
|
|
|
|
|
The name of the table has to be in the SQL command text before it is executed, and those tables must exist in the database-server. It's not possible to join on an in-memory object, as the command is executed before the dataset is returned.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Yes you right , how can join Data Table [Memory Table] with Sql Table on C#. Return Datatable.
see this cod
<pre lang="c#">
public DataTable Report_WarehouseStore()
{
dtWarehouse.iD = WarehouseStore.WarehouseiD
SqlDataAdapter da=new SqlDataAdapter(@"SELECT WarehouseStore.ProductID, WarehouseStore.ProductCode, WarehouseStore.ProductName, UnitPart.UnitPart, Warehouse.WarehouseName,WarehouseStore.ProductValue FROM WarehouseStore INNER JOIN UnitPart ON WarehouseStore.UnitPartID = UnitPart.UnitPartid INNER JOIN Warehouse ON Warehouse.WarehouseiD = WarehouseStore.WarehouseiD", new _Connections().Cnn);
DataTable dt = new DataTable();
da.TableMappings.Add("dtObject","dtObject");
da.TableMappings.Add("dtWarehouse","dtWarehouse");
da.Fill(dt);
return dt;
}
</pre>
Wants Run this Code
<pre lang="SQL">
SELECT WarehouseStore.ProductID, WarehouseStore.ProductCode, WarehouseStore.ProductName, UnitPart.UnitPart, Warehouse.WarehouseName,WarehouseStore.ProductValue FROM WarehouseStore INNER JOIN UnitPart ON WarehouseStore.UnitPartID = UnitPart.UnitPartid INNER JOIN Warehouse ON Warehouse.WarehouseiD = WarehouseStore.WarehouseiD INNER JOIN dtObject ON dtObject.iD = WarehouseStore.ProductCode INNER JOIN dtWarehouse ON dtWarehouse.iD = WarehouseStore.WarehouseiD
</pre>
-- modified 2-Jul-14 7:47am.
|
|
|
|
|
You don't join in memory; the join is declared in the query that is executed. Write your query accordingly, and use the table-name there.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I tried very hard, but I did not succeed,can you fix my code for Join two Data Table with database tables. Thanks
-- modified 2-Jul-14 13:12pm.
|
|
|
|
|
Hello. I have developed a simple win32 dll. When I try to use this dll in C#, I get the said exception. Then function that is causing the problem is shown below in both managed and unmanaged form
BOOL CMyFileHandler::SetFileName(LPCWSTR sFilePath)
{
}
[DllImport("Path of MyDll.dll", EntryPoint = "decorated name of GetFileName()")]
public static bool SetFileName(string sFilePath);
So what could I be doing wrong here? Thansks for an input.
|
|
|
|
|
Could be "decorated name of GetFileName()" - shouldn't that be SetFileName?
Otherwise, you will be trying to write to a C# string, which is not allowed.
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|