|
I have a BindingList holding my business objects of type User.
Inside User I have a property called Address of type Address. The Address class has properties for City, and StreetAddress.
If I bind a DataGridView to my BindingList of Users, how do I get a column to display the StreetAddress stored in the property Address?
I already tried a custom column with the DataPropertyName set to Address.StreetAddress but with no luck.
I've been Google searching this for hours and have found no articles making reference to this issue. Am I the only one confused by this?
-Mike
|
|
|
|
|
good day everyone,
i believe i have a stoooopid problem , here it is: i create an empty project, i connect to oracle using the Add new Data Source wizard, fine! when im done, i drag and drop the fields from the tree window but i cant update anything against the data base!! what's more, is im getting the very same stooopid problem when connection to access!!
this.pROFILETableAdapter.Update(this.dataSet1.PROFILE); //ORA-01745: invalid host/bind variable name
please help,
Muammar.
All generalizations are wrong, including this one!
|
|
|
|
|
Please tell me how can we make multiple SDI application to show one child window .... that can not maximized or minized.
|
|
|
|
|
hi hasan, first you need to set the container form "the parent" property mdi container to true from the form properties, then when poping up another form to be the child, do this
yourChildForm kid = new yourChildForm();
yourChildForm.MdiParent=this; //when invoking from the parent form
yourChildForm.Show();
for the child form, set the minimize/maximize options from the properties window to false;
regards,
Muammar.
All generalizations are wrong, including this one!
|
|
|
|
|
The Classes supplied by the .NET Framework cann't insert a breakpoint,Such as the ArrayList Class.When I want to know how this Class implements,but the MSDN only gives some information about the properites,functions signature,The details are not showed to me.Is there any way to see these classes details.For Example:How Can I debug into the Classes given by .NET Framework?
|
|
|
|
|
Reflector[^] will allow you to see the source of any .NET framework class.
|
|
|
|
|
Thanks.Whether the breakpoint can be placed into the class given by .NET Framework.Such as:
protected CollectionBase()
{
this.list = new ArrayList();
}
The CollectionBase is a class given by .NET,Can a breakpoiint be placed in here? though the Microsoft is forbidden!
|
|
|
|
|
wanlim0817 wrote: Thanks.Whether the breakpoint can be placed into the class given by .NET Framework.Such as:
protected CollectionBase()
{
this.list = new ArrayList();
}
The CollectionBase is a class given by .NET,Can a breakpoiint be placed in here? though the Microsoft is forbidden!
No. You can't debug step into the .NET framework classes because Microsoft doesn't supply the necessary files.
Are you trying to find a bug or do you just want to learn how the class works. Reflector is very good for finding the internal workings and understanding how things work in the .NET classes.
|
|
|
|
|
Hi Friends,
i want to move the record pointer of DataGridView using code in C#.
i m trying BindingMangerBase but the problem is this only passion of bmb changing but the record pointer of dgv is not moving.
:-Dthe same is working fine with VB.NET. this is a code of VB.NET
Public Class frmTest
Dim bmb As BindingManagerBase
Dim bs As New BindingSource
Private Sub frmTest_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
connDB()
End Sub
Private Sub connDB()
Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0; Data Source = D:\TEMP\TestADO\DB\db1.mdb;")
Dim da As New OleDbDataAdapter("Select * From tblAdd;", cn)
Dim dt As New DataTable
Dim ds As New DataSet
da.Fill(dt)
bs.DataSource = dt
dgv.DataSource = bs
bmb = BindingContext(bs)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
bmb.Position = 0
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
bmb.Position = bmb.Position + 1
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
bmb.Position = bmb.Position - 1
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
bmb.Position = bmb.Count - 1
End Sub
End Class
here is the code of C# which is not working fine
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace testBindings
{
public partial class Form1 : Form
{
private SqlConnection conn ;
private SqlDataAdapter da;
private DataSet ds;
public BindingSource bs;
public BindingManagerBase bmb;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
conn = new SqlConnection ("Data Source=myhome\\sqlexpress;Initial Catalog=ChickenPeoxX;Integrated Security=True");
da= new SqlDataAdapter ("select * from tblGroup;",conn );
ds= new DataSet ();
da.Fill(ds,"GROUP");
dgv.DataSource = ds.Tables[0];
bs = new BindingSource( );
bmb = BindingContext[bs];
bs.DataSource = ds.Tables[0];
}
private void button1_Click(object sender, EventArgs e)
{
bmb.Position = bmb.Position+ 1;
textBox1.Text = bmb.Position.ToString() ;
}
private void button2_Click(object sender, EventArgs e)
{
bmb.Position = bmb.Position-1;
textBox1.Text = bmb.Position.ToString();
}
}
}:(
please help me with this ...
thnX in Advance
Regards
Sonal
.::HuNTeR::.
|
|
|
|
|
I'm using the checkedIndices property of the checked listview control. when i iterate through it using the following line
for(int i=0; i<indices_count; i++)<br />
{<br />
int a = TableListBox.CheckedIndices[0];<br />
}
for every iteration of the for loop, i get a different value for a, but i am only accessing the value of index 0, and it should remain the same throughout the for loop.
why is it showing such abnormal behaviour???
|
|
|
|
|
if u try to get all checked value then try this....
for(int i=0 ; i < this.listView1.CheckedItems.Count ; i++ )
{
String tmp=this.listView1.CheckedItems[i].Text.ToString() ;
MessageBox.Show(tmp);
}
Keep Smiling !!!
Parwej Ahamad
g_parwez@rediffmail.com
|
|
|
|
|
Hello guys.
I'm stuck in one of the silliest problems anyone would ever imagine. Alright, my application is a password protected database application. I know!! I've already put the passwords of my application, and the database in an external file -not the main config. I got my reasons though-. Now I want to encrypt that external file to protect my passwords, and not to hardcode them in my program.
The funny thing is that I need a key, wich has to be the same in the Encrypting/Decrypting process. I don't want to hardcode that key -I know it's not the best practice-. Also I don't want to use the File.Encrypt() method, as it's easily broken -using the Decrypt ethod BTW-, and assumes that the user has NTFS.
I figured out an inconvenient way of maing the user's password, or my Assembly's GUID as that key.This is my last resort, but I'd really like to hear fresh ideas, as I'm out of!!
PS.
Currently I'm reading MSDN security section. Can you imagine how desperate I am now?
Regards
|
|
|
|
|
Poor thing!! but dont worry, im even stuck in a more stupid problem i cannt update the database im connected to!!
All generalizations are wrong, including this one!
|
|
|
|
|
The most used solution in cases like this is to store the Hash value of the password instead of the password itself. When a user tries to login, the program will compute the Hash code of the password provided by the user and compare it to the stored value.
This is very secure, especially if you use strong hashing algorithm like SHA1. The .NET Framework provides exhaustive support for hashing.
The only problem is that you no longer have the clear-text password. It might be a problem if the user forgets his password.
|
|
|
|
|
First, thank you for your reply.
I already applied that solution in the login password of the user. I now have some other sensitive data that I must encrypt in an external file. Where would I put the encryption key? That was my question -sorry if it wasn't clear the first time-.
Regards
|
|
|
|
|
I ran across the same problem. Since the application wasn't meant to be particularly secure, I just hard-coded the encryption key in the application, "hiding" it so that it doesn't seem a key but just an error message.
In other words, there is a fictitious error message, and I use that string to generate the key using a method with a name like PerformOperations, so that it does not seem encryption-related.
It's not very secure, but in my case it was enough.
|
|
|
|
|
Well. I guess I'd go for that if my time is cut short. Thanks for your time Dario.
Regards
|
|
|
|
|
Hi,
I'm doing some string wrapping calculation, and need graphics.MeasureString to calculate the width of each character.
One problem is, Graphics does not have constructor. How can I get or create Graphics object, if the wrapping calculation must be inside one class library, not inside a dialog?
Thanks so much for your help?
|
|
|
|
|
You can use TextRenderer.MeasureText() method instead.
Regards
|
|
|
|
|
yeah, but TextRenderer.MeasureText() takes IDeviceContext as argument, which he doesn't have.
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
|
|
|
|
|
|
|
Thanks dnh. I was wondering why it got two without the voting guy telling me what's wrong. When you posted your reply I thought you were the guy and that's your reason -felt little frustrated at first:->, sorry!-. Now I wonder again.
See you on the forums.
Regards
|
|
|
|
|
|
Thank you for all of your replies.
I have tried to use TextRenderer.MeasureText(), it works fine..
But I still prefer using Graphics to Measure, I found that it is more accurate. Because I need to set some scaleing and measure unit in graphics.
The method I get the Graphics is, I create a Form, and then use Form.CreateGraphics(), seems a stupid method ^_^, but works finally.
|
|
|
|