|
Can you post the code using the function FndObject?
The code you posted above doesnt seem to have any problems.
|
|
|
|
|
Why are you creating a new ClassName instance when the variable obj id immediately overwritten in then next statement?
The next thing you don't understand is that trying to retreive a an object via a key from a Hashtablehttp://msdn.microsoft.com/en-us/library/system.collections.hashtable.item(v=vs.80).aspx[^] will return null when there is nothing stored under that key:
MSDN wrote: The value associated with the specified key. If the specified key is not found, attempting to get it returns a null reference (Nothing in Visual Basic), and attempting to set it creates a new element using the specified key.
So what happens here is that whatever you passed into FindObject as a key has no instance of type ClassName associated with it.
Regards,
— Manfred
"I had the right to remain silent, but I didn't have the ability!"
Ron White, Comedian
|
|
|
|
|
Furthermore, the element at nKey may not be of type ClassName or a derived class - then the cast to ClassName will change it to null.
|
|
|
|
|
Hi can anybody plesae tell me is there any opensource BPM for .net rather than www.netbpm.org......
Thanks in advance
modified 5-Oct-12 2:36am.
|
|
|
|
|
DON'T SHOUT. Using all capitals is considered shouting on the internet, and rude (using all lower case is considered childish). Use proper capitalisation if you want to be taken seriously.
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
I am developing C# application.desktop application.
I am using Visual Studio 2010 & SQL server 2008
I am new to C#.
If I want to print a bill by taking a total of entry filled text boxes(i.e. printout of selected items only or non empty text boxes)then how will I do it?
I 'Bill' form I have taken 20 fileds for exa. nursing charges,anesthesia charges,likewise..
Different treatment requires different types of charges so,i will do entry only in selected fields among these 20 fields.
Bill printout should contain the fields which I have entered.
How will I do this?
Can anybody please help me?
Thank in advance.
|
|
|
|
|
S Akshay wrote: How will I do this?
Can anybody please help me?
With picking a report-generator? How about starting on MSDN[^]?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
How to trigger C# events using jquery
|
|
|
|
|
You might find this[^] a useful starting point.
|
|
|
|
|
I hope it may help you..
JQuery:
$(document).ready(function () {
$('#button1').click(function (event) {
$('#button2').click();
event.preventDefault();
return false;
});
});
HTML:
<asp:Button runat="server" ID="btn1" onclick="btn1_Click" Text="Button One" ClientIDMode="Static" />
<asp:Button runat="server" ID="btn2" onclick="btn2_Click" Text="Button Two" ClientIDMode="Static" />
<asp:Label runat="server" ID="lbl2"></asp:Label>
code behind for button2 click event:
protected void btn2_Click(object sender, EventArgs e)
{
var test2 = "test2";
lbl2.Text = "btn2_Click";
}
Paly
|
|
|
|
|
When I try to write to a comment tag field and save the file, I get either expected result, wrong result or an error. Does anyone have suggestions or tips? The intent is to add text to the metadata of jpg images so that I can search images later. Here's the code sofar:
private void buttonOpenFile_Click(object sender, EventArgs e)
{
using(OpenFileDialog d = new OpenFileDialog())
{
d.InitialDirectory = @"D:\";
d.Filter = "All jpeg files|*.jpg;*.jpeg";
d.ShowDialog();
_File = TagLib.File.Create(d.FileName,"image/jpeg", TagLib.ReadStyle.None);
}
textBox1.Text = _File.Tag.Comment;
}
private void buttonSaveFile_Click(object sender, EventArgs e)
{
_File.Tag.Comment = textBox1.Text;
_File.Save();
}
|
|
|
|
|
|
I already studied all i could find...no solution sofar!
|
|
|
|
|
Please help me how i read equation from word and display on asp .net page.
|
|
|
|
|
Please read this[^].
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Hello. I dont know deeply about this but; I know that private inhertience most likely means composition. Now I am using private inheritence in my small c++ project like this
BOOL ChildClass::Function()
{
return BaseClass::Function();
}
Now there is no private inhertence in C#. I can use composition here but how will I call BaseClass functions in ChildClass like above. How do I achieve this in C#? Thanks
This world is going to explode due to international politics, SOON.
|
|
|
|
|
protected is the keyword you are looking for.
MSDN (via Google) says: The protected keyword is a member access modifier. A protected member is accessible within its class and by derived class instances.
Protected sits in a sense between public and private.
Cheers,
Peter
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
Thanks for your reply. If ClassB is derived from ClassA using protected, and then ClassC is derived from ClassB using protected THEN; functions of ClassA will be available in ClassC as well. However, this is not the case when we implement same scenario using private inheritence. Am I wrong somewhere?
This world is going to explode due to international politics, SOON.
|
|
|
|
|
My background is more C++ than C#, so I'll suggest you look beyond me. Google threw up a lot of good stuff on "C# composition vs inheritance", including Composition VS Inheritance[^] right here on CP.
It also seems that you may need to drag in interfaces, depending on your exact needs.
Happy hunting,
Peter
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
As you have discovered, there is no real concept of private inheritance in C#. You can't hide the public properties and methods of a base class. The only real way that you could achieve this would be to have a member variable in your class, instead of using that type as a base class, and you'd just work with that.
|
|
|
|
|
AmbiguousName wrote: Now there is no private inhertence in C#.
Probably because there is so little point in using it.
I wouldn't be surprised if most uses really arise from a misuse of inheritence when someone thinks that inheritence is nothing more than a code simplification tool.
|
|
|
|
|
In a C# 2008 application, I have a foreach loop that is listed below:
for each (PkgID in PkgIDs)
{
Process eProcess = new Process();
String Process_Arguments = null;
eProcess.StartInfo.UseShellExecute = false;
eProcess.StartInfo.FileName = strConsoleAppLocation;
Process_Arguments = filedirectorypath + " 7654" + PkgID;
eProcess.StartInfo.Arguments = Process_Arguments;
eProcess.Start();
eProcess.WaitForExit(1800);
eProcess = null;
Process_Arguments = null;
}
As you can see from the code I listed above I have the following questions:
1. For each iteration of the for loop I create a new process object called eProcess and then I set
eProcess = null; near the end of the loop.
Thus can you tell me if this is code or not and why? If you have better code that I could use would you tell me what you recommend by pointing me to some code I can use as a reference?
2. You can see that I also have the following line of code,
eProcess.WaitForExit(1800);
I have this line since the process that is being called does not seem to complete its processing before the control is returned to this program.
Thus can you tell me the following:
a. Is the number of milliseconds that I specify a good amount? Can you tell me why or why not?
b. Since the code is returned to this calling program before the entire eProcess finished, can you tell me if this is a good way to wait for the eprocess to finish? I would think there is a better way to what for eProcess to finish. If so, is there a way to tell when the eProcess
is really finished executing?
|
|
|
|
|
foreach (PkgID in PkgIDs)
{
Process eProcess = new Process();
String Process_Arguments = null;
eProcess.StartInfo.UseShellExecute = false;
eProcess.StartInfo.FileName = strConsoleAppLocation;
Process_Arguments = filedirectorypath + " 7654" + PkgID;
eProcess.StartInfo.Arguments = Process_Arguments;
eProcess.Start();
eProcess.WaitForExit();
System.Threading.Thread.Sleep (1800);
eProcess = null;
Process_Arguments = null;
}
|
|
|
|
|
I m developing a CE application to read data from binary files which created by C++ progam to do item validation.
Below is the docing of the C++ program..
// File Name: Ean2an.bin which is created by struct
struct EAN2AN_TYPE
{
__int64 ean:40; // 5 bytes, up to 12 digits
__int64 rec_no:24; // 3 bytes rec no in the c_ItemMaster File, up to 16 million records
};
// After bind data to struct, wil create the binary file
bool CreateBin_EAN2AN_TYPE()
{
if(mn_RecordCount_EAN2AN_TYPE == 0) return false;
FILE *binfile;
qsort(mc_EAN2AN_TYPE, mn_RecordCount_EAN2AN_TYPE, sizeof(struct EAN2AN_TYPE), qsort_EAN2AN_TYPE);
try
{
binfile = fopen(ms_Path_EAN2AN_TYPE, "wb");
fwrite(&mc_EAN2AN_TYPE, sizeof(struct EAN2AN_TYPE), mn_RecordCount_EAN2AN_TYPE, binfile);
}
catch(Exception ^ex)
{
TaskProgramLibrary::Message::ERR("Create EAN2AN_TYPE.bin fail!\r\n " + ex->Message);
}
finally
{
fclose(binfile);
mdw_FileSize_EAN2AN_TYPE = FileSize(ms_Path_EAN2AN_TYPE);
}
return true;
. }
I tried to read the data by using binary read(based on position) and use bitconverter to convert to int64 or using Marshal.PtrToStructure, but the value return is incorrect. Then i tried to read 5 bytes instead of 8 bytes from the file, but the value return stil incorrect.
Below is C# coding wrote
//Struct created in C#
[StructLayout(LayoutKind.Sequential)]
public struct EAN2AN_TYPE
{
[MarshalAs(UnmanagedType.I8)]
public Int64 ean;
[MarshalAs(UnmanagedType.I8)]
public Int64 rec_no;
}
//HOw i read in C#
//1.Read Int64 by Binary
private void ReadByBinary()
{
using (BinaryReader b = new BinaryReader(_fs))
{
while (b.PeekChar() != 0)
{
Int64 x = b.ReadInt64();
Console.WriteLine(x.ToString());
}
}
}
//2.Using Marshal to convert the Intptr to struct's field type
private object ReadByMarshal(Type iType)
{
_oType = iType;// typeof(System.Int64);
byte[] buffer = new byte[Marshal.SizeOf(_oType)];
//byte[] buffer = new byte[5];
object oReturn = null;
try
{
_fs.Read(buffer, 0, buffer.Length);
GCHandle handle = GCHandle.Alloc(buffer, GCHandleType.Pinned);
oReturn = Marshal.PtrToStructure(handle.AddrOfPinnedObject(), _oType);
handle.Free();
return oReturn;
}
catch (Exception ex)
{
throw ex;
}
}
//3. Use Binary and use bit converter to convert to Int64
private void ReadByBinaryAndUseBitConverter()
{
using (BinaryReader b = new BinaryReader(_fs))
{
byte[] x = b.ReadBytes(8);
Int64 y = BitConverter.ToInt64(x, 0);
Console.WriteLine(y);
byte[] x2 = b.ReadBytes(8);
Int64 y2 = BitConverter.ToInt64(x2,0);
Console.WriteLine(y2);
}
}
//4. Use Marshal and convert to struct
public EAN2AN_TYPE GetStructValue()
{
byte[] buffer = new byte[Marshal.SizeOf(typeof(EAN2AN_TYPE)];
EAN2AN_TYPE oReturn = new EAN2AN_TYPE();
try
{
//if (EOF) return null;
_fs.Read(buffer, 0, buffer.Length);
GCHandle handle = GCHandle.Alloc(buffer, GCHandleType.Pinned);
IntPtr rawDataPtr = handle.AddrOfPinnedObject();
oReturn = (EAN2AN_TYPE)Marshal.PtrToStructure(rawDataPtr, typeof(EAN2AN_TYPE));
handle.Free();
if (_fs.Position >= _fs.Length)
Close();
return oReturn;
}
catch (Exception ex)
{
throw ex;
}
}
Anybody have any idea?
Thanks in advance
|
|
|
|
|
Hello i have a problem calling a PHP webservice. The following error accurs:
There is an error in XML document (2, 515). StackTrace: at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at ......
When i inspected the response from the webservice with Fidler. The error occurs at (2,515):
="1.0"="utf-8"
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="http://ws-test.nl/docQueue/service/index.php"
xmlns:types="http://ws-test.nl/docQueue/service/index.php/encodedTypes"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<tns:logIn>
<input href="#id1" />
</tns:logIn>
<tns:logIn id="id1" xsi:type="tns:logIn">
<username xsi:type="xsd:string">test</username>
<password xsi:type="xsd:string">welkom</password>
</tns:logIn>
</soap:Body>
</soap:Envelope>
Is there any way to resolve this error?
Ralph.
|
|
|
|