|
i'm trying to do as the title says...
im using a DataTable and add DataRow[] in it and every DR contains a column type of a class i have made. The class have 2 properties, a string and an int. Then i bind that DataTable to DataGridView. Now problem is that its showing the class name with Namespace and it should. But i want it to show that string property in that column.
Its exactly same like ComboBox or ListBox binding.
I tried with DataPropertyName but all columns appear blank
dataGridView.Columns[0].DataPropertyName = "Name";
full code
DataTable tmp_dt = new DataTable();
tmp_dt.Columns.Add("Info", typeof(XYZclass));
DataRow tmp_dr = tmp_dt.NewRow();
tmp_dr["Info"] = new XYZclass("a string Param to set the string in class");
tmp_dt.Rows.Add(tmp_dr);
dataGridView.DataSource = tmp_dt;
dataGridView.Columns[0].DataPropertyName = "Name";
any idea ?
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
You need to override the ToString() or create an implicit operator string (can't remember which one). Then, your class will correctly display wich ever string you want to be displayed in the datagridview.
|
|
|
|
|
Tony_P wrote: You need to override the ToString()
hmmm...seems to be gonna work...
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
removed
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
modified on Sunday, December 14, 2008 2:10 AM
|
|
|
|
|
Hi There,
i have problem using reportviewer,
when the values in the dataset are null it will show #Error label instead of blank field.
how can i replace or hide the null value into blank field ?
i tried =iff(fields!fieldName.value=Nothing,"",fieldName.value=Nothing) (on report)
(didn't work)
thanks
Roy
|
|
|
|
|
What on earth does this have to do with C# ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
2 things
1 fieldname.value will have DBNull.value
or
2 in your query use IsNull(fielname,'#Error')
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
But i want to Hide '#Error' Label or put blank field
when the value is DBNull.value,
not to show it?!?
Roy
|
|
|
|
|
Ok so turn it on it's head, in your SQL replace null with ''
If you can't think of that solution yourself then you have a serious problem.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
this was the first thing that i checked so you're not new to me anything.
your solution is not working,
because the dataset object cannot convert numbers/boolean to string..
it should be exactly as it's in the fields in db.
so please try harder, and think..
|
|
|
|
|
Hi All,
I'm just writing some tests using this framework and I can't figure out how to run a method after the tests have completed. Has anyone done this or know how to set it up?
Thanks,
|
|
|
|
|
I believe that xUnit recommends using Dispose, so your test looks like this:
[TestFixture]
public class MyTestClass : IDisposable
{
public MyTestClass()
{
}
private void DoMyTeardown()
{
}
public void Dispose()
{
DoMyTeardown();
Dispose(true);
}
private bool _disposed = false;
protected void Dispose(bool dispose)
{
if (dispose)
{
if (!_disposed)
{
_disposed = true;
}
}
GC.SuppressFinalize(this);
}
} Then, your calling code does this:
using (MyTestClass test = new MyTestClass())
{
}
|
|
|
|
|
Payment negotiable [not ridiculous price but pays well for work need].
Payment made via Paypal
Get in contact : Lbcorsa05 |at| hotmail |dot| co |dot| uk
input/output, + console graphics
|
|
|
|
|
Sorry, seems you have a slight typo in the URL.
www.rentacoder.com is what you meant to type.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
This site has a job board, you're more than welcome to advertise there.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Nomadico wrote: very small program
What metric are you using to define "very small program"?
Nomadico wrote: 75 % complete already
Is that just development? Or does that include testing too? And how are you measuring completeness?
Nomadico wrote: not ridiculous price but pays well for work need
Since you posted this in the C# forum, I'll assume it is a C# program you want written. Also, since your email address is from the UK, I'll assume you are paying UK prices.
Currenlty, the UK average for C# developers on a freelance basis is £37 per hour. Therefore if you "pay well" you will have to beat the average. Are you willing to pay that?
|
|
|
|
|
Colin Angus Mackay wrote: Currenlty, the UK average for C# developers on a freelance basis is £37 per hour. Therefore if you "pay well" you will have to beat the average. Are you willing to pay that?
ROTFL !!!! yeah, he doesn't have money to post a job ad, but he's paying well.
Of course, I know you know this.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Nomadico wrote: Need to 'hire' a programmer
I know what it means to hire someone, but what does it mean to "hire" someone? I don't know if I would want to be "hired"...
Nomadico wrote: 75 % complete already
Which means that about 150% of the work is left... 50% to understand the current code, 50% to remove what's wrong in it, and 50% to complete what left of it...
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
<quote>Which means that about 150% of the work is left... 50% to understand the current code, 50% to remove what's wrong in it, and 50% to complete what left of it...
thats right
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Me me 'hire' me. I'm a tart - erm contractor, hire me.
Send me the existing source and the requirement specs and I'll get right to it.
Be prepared to deposit $3000 US for me to asses the requirements (told you I was a tart) and I'll supply an estimate for the completion of the job.
Or - use the job board or rentacoder.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: I'm a tart
You slag.
|
|
|
|
|
Hi! How I can get the value of <fullname> programatically in a code-behind file and put in a label. I have declared in the web.config a statement:
profile
properties
add name="FullName" defaultValue="Anonymous" allowAnonymous="true"
properties
profile
now I want to get the value of the FullName in the code-behind file?
so the LabelName.Text = ???
Thx, Laziale
|
|
|
|
|
I guess you've got the wrong forum, try ASP.Net forum instead
Regards,
Lev
|
|
|
|
|
Hi all,
I have a 32-bit process that presents the user a dialog box similar to Regedit. On 64-bit OSes, because of registry redirection, when I attempt to read something under HKLM\SOFTWARE, the OS transparently provides my app with the data that appears under HKLM\SOFTWARE\Wow6432Node. That's great and all...
However, since my app is 32-bit, any data that has been written to HKLM\SOFTWARE by a 64-bit app is not visible to me.
Whether I set the path to read as HKLM\SOFTWARE or HKLM\SOFTWARE\Wow6432Node yields the same results--I'm only seeing the values that appear under HKLM\SOFTWARE\Wow6432Node.
My app has the ability to connect to the registry across the network--if I'm on a 32-bit OS and remotely access the registry of a 64-bit machine, then I'm seeing both branches just as Regedit would show them (since registry redirection does not work across machine boundaries, I'm getting the "raw view").
Compiling my app as 64-bit (or AnyCPU) is not an option right now, because my app also relies on third-party components that are only available as 32-bit.
So...how can a 32-bit app, running on a 64-bit OS, access the data under the "real" HKLM\SOFTWARE? Read-only would be fine--I just need the data to be visible...
PS - I'm aware of the KEY_WOW64_64KEY and KEY_WOW64_32KEY flags...however, I'm not seeing any provisions in .NET's registry classes to specify them...do I really have to rewrite my existing code to use P/Invoke??
modified on Saturday, December 13, 2008 11:59 AM
|
|
|
|
|
The following info is from MSDN:
By default, a 32-bit application running on WOW64 accesses the 32-bit registry view and a 64-bit application accesses the 64-bit registry view. The following flags enable 32-bit applications to access reflected keys in the 64-bit registry view and 64-bit applications to access reflected keys in the 32-bit registry view.
Flag name Value Description
KEY_WOW64_64KEY 0x0100 Access a 64-bit key from either a 32-bit or 64-bit application.
Windows 2000: This flag is not supported.
KEY_WOW64_32KEY 0x0200 Access a 32-bit key from either a 32-bit or 64-bit application.
Windows 2000: This flag is not supported.
These flags can be specified in the samDesired parameter of the following registry functions:
RegCreateKeyEx
RegDeleteKeyEx
RegOpenKeyEx
|
|
|
|