|
If an abstract class contains one method with only declaration and with no body, will it gets executed with no errors? Thanks in advance
|
|
|
|
|
Hi,
yes the code will be executed as the Abstract Classes are not used to create objects.
An abstract class is designed to act as a base class (to be inherited by other classes). Abstract class is a design concept in program development and provides a base upon which other classes are built.
To know more about the same, please refer to the below mentioned link:
[^]
http://www.codeproject.com/KB/cs/jmabstractclasses.aspx[^]
Hope this helps.
Vinay
ComponentOne LLC.
www.componentone.com
|
|
|
|
|
Well, you can't really execute an abstract method. A class would have to be derived from the abstract class and implement the abstract method. Then you can execute the actual method.
An abstract class may contain a non-abstract method, it will require a body, but that body may be empty (or at least an appropriate return statement).
|
|
|
|
|
Hello everyone,
Meta data for an assembly describes the exposed and referred types of the assembly. I am wondering the the debug version and release version of the assembly, are the meta data the same or not?
thanks in advance,
George
|
|
|
|
|
Well, depends what you mean. Some of it has to differ, but the 'exposed and refered types' obviously do not.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thanks Christian,
Christian Graus wrote: Some of it has to differ
I am wondering what are the differences?
regards,
George
|
|
|
|
|
I have a C#-Component with some logic implemented.
This logic is used from my web application and a C++ application.
Debugging the C#-Component from the web application is no problem.
But now I am faced with the problem to debug the C#-component from the C++ application which is unmanaged code.
If I start the application and try to attach the debugger after that, the MS Visual Studio 2003 raises an error message with the following info:
"Unabled to attach to the process. There is no managed code running..."
So I tried the following. I made (for debugging only) a global instance of my C#-component with is loading at start up of the C++ application. Now, when I try to attach the debugger the MS VS says only:
"Unabled to attach to the process." So the debugger noticed my managed code running but he cant attach nevertheless.
So do you have any ideas what the problem could be?
Thanks in advance.
Erik
|
|
|
|
|
I wish to build a multi sized array to read data from a specific source (in this case an SQLDataReader). The following code DOES work however it seems fairly drawn out and I'm certain that it could be done in less code. I'm fairly new to C# hence why I think my way of doing it possibly isn't the most efficient.
Without giving the array a size I get a compiling error and thus have to have two while loops to give the array a size. Is there a better way to do this?
Many thanks.. Ant
MSSQLConn.Open();
SqlCommand MSSQLCommandSelect = new SqlCommand();
MSSQLCommandSelect.CommandText = "SELECT TrackingID FROM Tracking WHERE " + FieldToSearch + " = " + DataToSearch;
MSSQLCommandSelect.Connection = MSSQLConn;
SqlDataReader reader = MSSQLCommandSelect.ExecuteReader();
int[] TrackingIDs;
int i = 0;
while (reader.Read() == true)
{
i++;
}
reader.Close();
reader = null;
reader = MSSQLCommandSelect.ExecuteReader();
TrackingIDs = new int[i];
i = 0;
TrackingIDs[0] = -1;
while (reader.Read() == true)
{
TrackingIDs[i] = (int)reader[0];
i++;
}
reader.Close();
MSSQLConn.Close();
return TrackingIDs;
|
|
|
|
|
|
Only use ArrayList if you're stuck with .net 1.1, if you have 2.0 and above you're better off using the generic List.
He who makes a beast out of himself gets rid of the pain of being a man
|
|
|
|
|
Thank you I shall give both those options a try.
ta - ant
|
|
|
|
|
Hi,
I want to write a GENERIC method to retrieve a property from an object from the specified index.
For example, I have three classes as listed below . OrderHeader contains a list of OrderDetail and OrderDetail Contains a list of OrderItem.
public class OrderItem<br />
{<br />
private int _itemId ;<br />
<br />
public int ItemId<br />
{<br />
get { return _itemId; }<br />
set { _itemId = value; }<br />
}<br />
private string _ItemName ;<br />
<br />
public string ItemName<br />
{<br />
get { return _ItemName; }<br />
set { _ItemName = value; }<br />
}<br />
}<br />
<br />
<br />
public class OrderDetail<br />
{<br />
<br />
private IList<OrderItem> _orderItemList;<br />
private int _orderDetailId;<br />
private int _amount;<br />
<br />
public IList<OrderItem> OrderItemList<br />
{<br />
get { return _orderItemList; }<br />
set { _orderItemList = value; }<br />
}<br />
<br />
public int OrderDetailId<br />
{<br />
get { return _orderDetailId; }<br />
set { _orderDetailId = value; }<br />
}<br />
<br />
public int Amount<br />
{<br />
get { return _amount; }<br />
set { _amount = value; }<br />
}<br />
}<br />
<br />
public class OrderHeader<br />
{<br />
private int _orderHeaderId;<br />
private IList<OrderDetail> _orderDetailList;<br />
<br />
public int OrderHeaderId<br />
{<br />
get { return _orderHeaderId; }<br />
set { _orderHeaderId = value; }<br />
}<br />
<br />
public IList<OrderDetail> OrderDetailList<br />
{<br />
get { return _orderDetailList; }<br />
set { _orderDetailList = value; }<br />
}<br />
<br />
}
First input to the method is an object (Example: OrderHeader Object)
Second input is a string with the required propety name and stirng. --> "OrderHeaderObject.OrderDetailList[1].OrderItemList[0].ItemName".
And the output should be the ItemName string.
What would the best way to acheive this..?
Can i achive it by using the method InvokeMember() method..? Example: OrderHeaderObject.GetType().InvokeMember(....)
Where did error begin?
-- Naison Garvasis Pekkattil
|
|
|
|
|
i am using -->
i am using textEditor.but i donot know how to get text string within tag .if you know the answer replay to me......(.net with c#)
|
|
|
|
|
Wrong forum, head over to the ASP.NET forums and someone may help you there.
He who makes a beast out of himself gets rid of the pain of being a man
|
|
|
|
|
thank you...i forgot it ..thank you so much.
|
|
|
|
|
hi,
I have loaded more images in one form. Whenever i minimize and
maximize the application design not displayed correctly. How to solve
this problem? Please help me. Thanks in advance.
|
|
|
|
|
selvarajanlatha,
You'll need to provide some code and a screen shot of the problem. You haven't provided enough info.
Regards,
Gareth.
|
|
|
|
|
I'm developing a new browser like internet explorer with c#.net. i need a solution for how to set the search provider while browsing with my browser. Any body knows c#.net coding for that pl help. thank u.
|
|
|
|
|
Thirukkumaran wrote: I'm developing a new browser like internet explorer with c#.net.
You mean you're hosting an IE control in your app?
Thirukkumaran wrote: i need a solution for how to set the search provider while browsing with my browser.
Go to Google, Yahoo, or any other search provider you want to support. Search for some word and note the URL of the page that gets returned. Should take you 5 mins to get that working from your own TextBox.
Cheers,
Vikram.
The hands that help are holier than the lips that pray.
|
|
|
|
|
Hiii...
I am receiving this error :--->
Server encountered an internal error. For more information, turn on customErrors in the server's .config file.
Server stack trace:
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
1) After googling, I found that customErrors mode="off can help.
Presently its True on Server side. Like this
RemotingConfiguration.CustomErrorsEnabled(true);
2) I am using .Net 1.1 on the server side and .Net 2.0 on client side.
3) Not getting this problem frequently. It has only 5% chances.
4) When I debugging found some interesting stuff:
class One
{
public string m_sResult = null;
public string GetInfo(string sID)
{
try
{
if(OnRequested != null)
OnRequested(sID);
return m_sResult;
}
catch(Exception ex)
{
WriteLog(“ “);
}
}
}
class Two{
void OnRequestedHandler(string sID)
{
try
{
One.m_sReult = "Done";
}
catch(Exception ex)
{
One.m_sReult = ex.message;
}
}
}
From the client side, I am calling One.GetInfo() method.
a) Event OnRequested(sID) raised and handled by class Two and One.m_sReult is set as "Done".
b) But on client side it returns NULL and also writes Log "Server encountered and internal....." on Server side.
So suggest me, what I should do to solve this problem.
I should use customErrors mode="off for better understanding?
I would appreciate any help or suggestions that anyone can provide.
Thank you.
Sidh
|
|
|
|
|
Member 3824736,
Wrong forum. You want ASP.NET
Regards,
Gareth.
|
|
|
|
|
|
Hi,
I want to know if there is any event to know if the print button on the report viewer toolbar is clicked. I want to do some database updations only if the report is printed.
The alternative is to not use the toolbar button and do the printing on some button click on the form. But i dont want to do that.
Please reply if anyone know anything abt this.
-Abhijeet
|
|
|
|
|
I am trying to generate mof file from mib file by calling cmd.exe from my .net application and then executing a command from CMD.exe for genearting mof file .please go through the following code
-----------------------------------------------
////sample code///
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using System.ComponentModel;
using System.IO;
namespace Console_sample
{
class Program
{
public void OpenWithArguments()
{
string dir = @"C:\WINDOWS\system32\wbem\snmp";
//Set the current directory.
Directory.SetCurrentDirectory( dir );
ProcessStartInfo startInfo = new ProcessStartInfo("CMD.exe");
Process p = new Process();
startInfo.RedirectStandardInput = true;
startInfo.UseShellExecute = false;
startInfo.RedirectStandardOutput = true;
startInfo.RedirectStandardError = true;
p = Process.Start(startInfo);
p.StandardInput.WriteLine(@"Echo on");
p.StandardInput.WriteLine(@"smi2smir /a RFC1213-MIB.mib ");
p.StandardInput.WriteLine(@"mofcomp RFC1213-MIB.mof ");
p.StandardInput.WriteLine(@"EXIT");
string output = p.StandardOutput.ReadToEnd();
string error = p.StandardError.ReadToEnd();
p.WaitForExit();
Console.Write(output);
p.Close();
Console.Read();
}
static void Main(string[] args)
{
Program myProcess = new Program();
myProcess.OpenWithArguments();
}
}
}
////code ends///
-------------------------------------------------
In this code the line p.StandardInput.WriteLine(@"smi2smir /a RFC1213-MIB.mib "); is not getting excuted .when i run this command smi2smir /a RFC1213-MIB.mib in command prompt it's getting excuted .even the next line of code is working fine .
can anyone tell how to fix this problem?Actually i am looking for WMI COM API for generating mof file from mib file but i didn't get it so i am trying to do it by another way .if anyone can give me API for following command in C# .net it will be very helpfull.
any help appreciated
Thanks in advance
|
|
|
|
|
Hi!
There is a DataTable, according to this table I need to do a simple column chart... I think I need to use a ReportViewer control but HOW???
MSDN article offer the next solving of this problem:
ReportViewer1.ProcessingMode = ProcessingMode.Local;
ReportViewer1.LocalReport.ReportPath = @"c:\Reports\Report1.rdl";
ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("Sales", LoadSalesData()));
ReportViewer1.LocalReport.Render(
"Excel", null, out mimeType, out encoding,
out extension,
out streamids, out warnings);
In result I get an empty ReportViewer1 ...
Please help!
|
|
|
|