I get this message in "Spaltenbre ite definieren" => Definition for Columns
Width
An unhandled exception of type 'System.NullRef erenceException ' occurred in
WindowsApplicat ion1.exe
Additional information: Object reference not set to an instance of an
object.
Please help me.
Thanks
Michael
CODE:
=====
private void CreateMyDatagri d()
{
// MyDatagrid erstellen
DataGrid MyDataGrid = new DataGrid();
MyDataGrid.Boun ds = new Rectangle(new Point(10,10), new Size(650,350));
// Datagrid Eigenschaften
MyDataGrid.Capt ionText="Berech tigung -> ALLE = A+B+E+L / A=Ansehen /
B=Bearbeiten / E = Erstellen / L=Löschen";
MyDataGrid.Read Only = false;
// Dataset erstellen
DataSet MyDataSet = new DataSet();
DataGridTableSt yle myTableStyle = new DataGridTableSt yle();
myTableStyle.Ma ppingName = "MappingName_ts _berechtigung"; // ts=tablestyle
DataGridBoolCol umn boolCol = new DataGridBoolCol umn();
boolCol.Mapping Name="MappingNa me_dgbc_berecht igung";
//dgbc=datagridbo olcolumn
((DataGridBoolC olumn)boolCol). AllowNull = false;
myTableStyle.Gr idColumnStyles. Add(boolCol);
//MyDataGrid.Tabl eStyles.Clear() ;
// DataTable erstellen
DataTable dt = new DataTable("Data Table_Berechtig ung");
// Spalten erstellen
dt.Columns.Add( "Modul", typeof(string)) .ReadOnly = true;
dt.Columns.Add( "Zusatz..." , typeof(string)) .ReadOnly = true;
dt.Columns.Add( "ALLE", typeof(bool));
dt.Columns.Add( "A", typeof(bool));
dt.Columns.Add( "B", typeof(bool));
dt.Columns.Add( "E", typeof(bool));
dt.Columns.Add( "L", typeof(bool));
//Spaltenbreite definieren
myTableStyle.Gr idColumnStyles["Modul"].Width=20;
myTableStyle.Gr idColumnStyles["Zusatz..."].Width=50;
myTableStyle.Gr idColumnStyles["ALLE"].Width=60;
//MyDataGrid.Tabl eStyles["DataTable_Bere chtigung"].GridColumnStyl es[0].Width
=0;
//MyDataGrid.Tabl eStyles["DataTable_Bere chtigung"].GridColumnStyl es[1].Width
=80;
//MyDataGrid.Tabl eStyles["DataTable_Bere chtigung"].GridColumnStyl es[2].Width
=80;
//MyDataGrid.Tabl eStyles["DataTable_Bere chtigung"].GridColumnStyl es[3].Width
=20;
// Zeilen erstellen und inhalt abfüllen
// checkbox in variable
int test = 1;
dt.Rows.Add(new Object[] {"Adresse", "ev. sonst noch was",0,test,0,0 ,0});
dt.Rows.Add(new Object[] {"Depositen" , "ev. sonst noch was",1,1,1,1,1} );
dt.Rows.Add(new Object[] {"Obligation ", "ev. sonst noch was",0,0,0,0,0} );
dt.Rows.Add(new Object[] {"Miete", "ev. sonst noch was",1,1,1,1,1} );
dt.Rows.Add(new Object[] {"Stammdaten ", "ev. sonst noch was",0,0,0,0,0} );
// DataTable in dataset
MyDataSet.Table s.Add(dt);
// Dataset in datagrid
MyDataGrid.SetD ataBinding(MyDa taSet,"DataTabl e_Berechtigung" );
// Tablestyle dem Datagrid hinzufügen
MyDataGrid.Tabl eStyles.Add(myT ableStyle);
// Anzeigen des Datagrids
this.Controls.A dd(MyDataGrid);
} 4 5973
"michael walser" <mi************ @bingo.de> wrote in
news:eZ******** *****@TK2MSFTNG P12.phx.gbl: I get this message in "Spaltenbre ite definieren" => Definition for Columns Width
An unhandled exception of type 'System.NullRef erenceException ' occurred in WindowsApplicat ion1.exe
Additional information: Object reference not set to an instance of an object.
Please help me. // Spalten erstellen
dt.Columns.Add( "Modul", typeof(string)) .ReadOnly = true; dt.Columns.Add( "Zusatz..." , typeof(string)) .ReadOnly = true; dt.Columns.Add( "ALLE", typeof(bool));
.... //Spaltenbreite definieren
myTableStyle.Gr idColumnStyles["Modul"].Width=20; myTableStyle.Gr idColumnStyles["Zusatz..."].Width=50; myTableStyle.Gr idColumnStyles["ALLE"].Width=60;
In the debugger, could you please check if these column styles are
actually defined? You probably should add a new GridColumnStyle first.
Frans.
--
Get LLBLGen Pro, the new O/R mapper for .NET: http://www.llblgen.com
My .NET Blog: http://weblogs.asp.net/fbouma
Microsoft C# MVP
Frans Bouma [C# MVP] wrote: "michael walser" <mi************ @bingo.de> wrote in news:eZ******** *****@TK2MSFTNG P12.phx.gbl:
I get this message in "Spaltenbre ite definieren" => Definition for Columns Width
An unhandled exception of type 'System.NullRef erenceException ' occurred in WindowsApplicat ion1.exe
Additional information: Object reference not set to an instance of an object.
Please help me. // Spalten erstellen
dt.Columns.Ad d("Modul", typeof(string)) .ReadOnly = true; dt.Columns.Ad d("Zusatz..." , typeof(string)) .ReadOnly = true; dt.Columns.Ad d("ALLE", typeof(bool));
...
//Spaltenbreite definieren
myTableStyle. GridColumnStyle s["Modul"].Width=20; myTableStyle. GridColumnStyle s["Zusatz..."].Width=50; myTableStyle. GridColumnStyle s["ALLE"].Width=60;
In the debugger, could you please check if these column styles are actually defined? You probably should add a new GridColumnStyle first.
Frans.
Yes? that's right. I met with this error many time.
Frans Bouma [C# MVP] wrote: "michael walser" <mi************ @bingo.de> wrote in news:eZ******** *****@TK2MSFTNG P12.phx.gbl:
I get this message in "Spaltenbre ite definieren" => Definition for Columns Width
An unhandled exception of type 'System.NullRef erenceException ' occurred in WindowsApplicat ion1.exe
Additional information: Object reference not set to an instance of an object.
Please help me. // Spalten erstellen
dt.Columns.Ad d("Modul", typeof(string)) .ReadOnly = true; dt.Columns.Ad d("Zusatz..." , typeof(string)) .ReadOnly = true; dt.Columns.Ad d("ALLE", typeof(bool));
...
//Spaltenbreite definieren
myTableStyle. GridColumnStyle s["Modul"].Width=20; myTableStyle. GridColumnStyle s["Zusatz..."].Width=50; myTableStyle. GridColumnStyle s["ALLE"].Width=60;
In the debugger, could you please check if these column styles are actually defined? You probably should add a new GridColumnStyle first.
Frans.
Yes, that's right. I met with this error many time.
Yes it works.
// Tablestyle erstellen
DataGridTableSt yle myTableStyle = new DataGridTableSt yle();
myTableStyle.Ma ppingName = "DataTable_Bere chtigung";
MyDataGrid.Tabl eStyles.Clear() ;
// Spalten-Eigenschaften
DataGridTextBox Column Col_0 = new DataGridTextBox Column();
Col_0.MappingNa me="Modul";
Col_0.Width = 150;
Col_0.ReadOnly = true;
Col_0.HeaderTex t = "Module";
DataGridBoolCol umn Col_1 = new DataGridBoolCol umn();
Col_1.MappingNa me="ALLE";
Col_1.Width = 60;
Col_1.AllowNull = false;
Col_1.HeaderTex t = "ALLE";
Col_1.Alignment = System.Windows. Forms.Horizonta lAlignment.Cent er;
DataGridBoolCol umn Col_2 = new DataGridBoolCol umn();
......etc etc..
Thanks for your help
Michael This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: michael walser |
last post by:
I get this message in "Spaltenbreite definieren" => Definition for Columns
Width
An unhandled exception of type 'System.NullReferenceException' occurred in
WindowsApplication1.exe
Additional information: Object reference not set to an instance of an
object.
Please help me.
|
by: Christopher Young |
last post by:
I have several user controls on a page and I am trying to
get information out of them. The postback is being caused
on the aspx page and not in the user control. I have
tried using a property but I keep getting a message that
the object is not referenced.
What I am trying to do is be information from text boxes
and insert them into a new row in a dataset. The
application has several tabs of information. I have a
button set up so they...
|
by: Brad |
last post by:
Receive the following error when stepping into the FILL (see last line).
Being a newbie I cannot see anything obvious.
Error message:
An unhandled exception of type 'System.NullReferenceException' occurred in
system.data.dll
Additional information: Object reference not set to an instance of an object.
Code:
|
by: Supra |
last post by:
I am doing irc chat similar to mirc chat if i connected to
irc.webamster.com i had no problem. but if connected to eu.undernet.org.
i got error....somthing bug me! O:-)
'February 2004
'An unhandled exception of type 'System.NullReferenceException' occurred
in system.windows.forms.dll
'Additional information: Object reference not set to an instance of an
object.
|
by: Supra |
last post by:
'An unhandled exception of type 'System.NullReferenceException' occurred
in system.windows.forms.dll
'Additional information: Object reference not set to an instance of an
object.
in module:
Dim nrtb As New RichTextBox
Sub DisplayMessage(ByVal rtb As RichTextBox, ByVal sText As String,
Optional ByVal Colour As String = "")
rtb.SelectionStart = rtb.Text.Length
' rtb.doColor(rtb, DirectCast(sText, String))
| |
by: Andrew Poulos |
last post by:
With the following code I can't understand why this.num keeps
incrementing each time I create a new instance of Foo. For each instance
I'm expecting this.num to alert as 1 but keeps incrementing.
Foo = function(type) {
this.num = 0;
this.type = type
this.trigger();
}
Foo.prototype.trigger = function() {
|
by: Shailen Sukul |
last post by:
Observed a weird behaviour with object references.
See code listing below:
using System;
using System.Collections.Generic;
using System.Text;
namespace PointerExceptionTest
{
/*
|
by: Ralph |
last post by:
Hi
I don't understand why it's not working:
function schedule(imTop){
this.tdImagesTop = imTop;
}
schedule.prototype.selectEl = function() {
alert(this.tdImagesTop);
|
by: raylopez99 |
last post by:
Keywords: scope resolution, passing classes between parent and child
forms, parameter constructor method, normal constructor, default
constructor, forward reference, sharing classes between forms.
Here is a newbie mistake that I found myself doing (as a newbie), and
that even a master programmer, the guru of this forum, Jon Skeet,
missed! (He knows this I'm sure, but just didn't think this was my
problem; LOL, I am needling him)
If...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |