Saturday, March 31, 2012
System.Drawing: Error when using a .bmp or .gif file but not when .jpg
whenever I use a .jpg file it works perfect.
Why is that? and how to fix it?
I almost have no knowledge about the system.drawing and so I am in the dark
about this.
This is my code
--
<%@dotnet.itags.org. Page Language="vb" %>
<%@dotnet.itags.org. import namespace="system.drawing" %>
<%@dotnet.itags.org. import namespace="system.drawing.imaging" %>
<%@dotnet.itags.org. import namespace="system.drawing.drawing2d" %>
<%
' initialise objects
dim strFilename as string
dim b as New System.Drawing.Bitmap(server.mappath("test.jpg"))
dim g as graphics = graphics.fromimage(b)
g.smoothingMode = smoothingMode.antiAlias
dim stringFormat As New StringFormat()
g.drawString("The Magic Word", New font("arial",3),systembrushes.windowtext,
New pointF(2,2), stringFormat)
' Set the content type
response.contenttype="image/jpeg"
' send the image to the viewer
b.save(response.outputstream, b.rawformat)
' tidy up
b.dispose()
%>Hi Richard,
As for the "A Graphics object cannot be created from an image that has an
indexed pixel format" error, it is caused by the Graphic object can't been
created from some certain image format which contains indexed pixel. I've
done some tests and one means is load the image and convert it into jpeg
format first and then create Graphich object to manipulate it. For example,
here is my test code:
========================================
==========
Private Sub Output_Image(ByVal path As String)
Try
Dim img As Image = Image.FromFile(path)
Dim stream As New System.IO.MemoryStream
img.Save(stream, ImageFormat.Jpeg)
Dim imgNew As Image = Image.FromStream(stream)
Dim g As Graphics = Graphics.FromImage(imgNew)
g.DrawString("MS Test", New Font("Verdana", 20,
FontStyle.Bold), _
New SolidBrush(Color.Beige), 0, 0)
Response.Clear()
Response.ContentType = "Image/jpeg"
imgNew.Save(Response.OutputStream, ImageFormat.Jpeg)
Response.End()
img.Dispose()
stream.Close()
imgNew.Dispose()
Catch ex As Exception
Response.Write("<br>" + ex.Message)
End Try
End Sub
========================================
=========
Please have a try to see whether it works for you. Thanks.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
thx a lot, this really helped me out.
I got no errors and with some thinking I made sure ppl can't link to my
files. (put a http://www. infront of url to view)
digifan.nl/ShowGalleryImage.aspx? img=Jlz1wB3JMO636rzX3rGMrpOK7mbHBTzFQQ1O
Q%2
fJ5V3Y%3d
and looking at the properties of the image it shows:
digifan.nl/ShowFullImage.aspx? img=Jlz1wB3JMO636rzX3rGMrpOK7mbHBTzFQQ1O
Q%2fJ5
V3Y%3d
which is only the image.
Again thx, i am going to read a bit some more about the system.drawing and
what it al can do but now i have an understanding of
the general thing.
Richard
"Steven Cheng[MSFT]" <v-schang@.online.microsoft.com> schreef in bericht
news:VQpV0n2UEHA.3204@.cpmsftngxa10.phx.gbl...
> Hi Richard,
> As for the "A Graphics object cannot be created from an image that has an
> indexed pixel format" error, it is caused by the Graphic object can't been
> created from some certain image format which contains indexed pixel. I've
> done some tests and one means is load the image and convert it into jpeg
> format first and then create Graphich object to manipulate it. For
example,
> here is my test code:
> ========================================
==========
> Private Sub Output_Image(ByVal path As String)
> Try
> Dim img As Image = Image.FromFile(path)
> Dim stream As New System.IO.MemoryStream
> img.Save(stream, ImageFormat.Jpeg)
> Dim imgNew As Image = Image.FromStream(stream)
> Dim g As Graphics = Graphics.FromImage(imgNew)
> g.DrawString("MS Test", New Font("Verdana", 20,
> FontStyle.Bold), _
> New SolidBrush(Color.Beige), 0, 0)
> Response.Clear()
> Response.ContentType = "Image/jpeg"
> imgNew.Save(Response.OutputStream, ImageFormat.Jpeg)
> Response.End()
>
> img.Dispose()
> stream.Close()
> imgNew.Dispose()
> Catch ex As Exception
> Response.Write("<br>" + ex.Message)
> End Try
> End Sub
> ========================================
=========
> Please have a try to see whether it works for you. Thanks.
> Regards,
> Steven Cheng
> Microsoft Online Support
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
> Get Preview at ASP.NET whidbey
> http://msdn.microsoft.com/asp.net/whidbey/default.aspx
>
System.Drawing: Error when using a .bmp or .gif file but not when .jpg
whenever I use a .jpg file it works perfect.
Why is that? and how to fix it?
I almost have no knowledge about the system.drawing and so I am in the dark
about this.
This is my code
-----------
<%@dotnet.itags.org. Page Language="vb" %>
<%@dotnet.itags.org. import namespace="system.drawing" %>
<%@dotnet.itags.org. import namespace="system.drawing.imaging" %>
<%@dotnet.itags.org. import namespace="system.drawing.drawing2d" %>
<%
' initialise objects
dim strFilename as string
dim b as New System.Drawing.Bitmap(server.mappath("test.jpg"))
dim g as graphics = graphics.fromimage(b)
g.smoothingMode = smoothingMode.antiAlias
dim stringFormat As New StringFormat()
g.drawString("The Magic Word", New font("arial",3),systembrushes.windowtext,
New pointF(2,2), stringFormat)
' Set the content type
response.contenttype="image/jpeg"
' send the image to the viewer
b.save(response.outputstream, b.rawformat)
' tidy up
b.dispose()
%thx a lot, this really helped me out.
I got no errors and with some thinking I made sure ppl can't link to my
files. (put a http://www. infront of url to view)
digifan.nl/ShowGalleryImage.aspx?img=Jlz1wB3JMO636rzX3rGMrpOK 7mbHBTzFQQ1OQ%2
fJ5V3Y%3d
and looking at the properties of the image it shows:
digifan.nl/ShowFullImage.aspx?img=Jlz1wB3JMO636rzX3rGMrpOK7mb HBTzFQQ1OQ%2fJ5
V3Y%3d
which is only the image.
Again thx, i am going to read a bit some more about the system.drawing and
what it al can do but now i have an understanding of
the general thing.
Richard
"Steven Cheng[MSFT]" <v-schang@.online.microsoft.com> schreef in bericht
news:VQpV0n2UEHA.3204@.cpmsftngxa10.phx.gbl...
> Hi Richard,
> As for the "A Graphics object cannot be created from an image that has an
> indexed pixel format" error, it is caused by the Graphic object can't been
> created from some certain image format which contains indexed pixel. I've
> done some tests and one means is load the image and convert it into jpeg
> format first and then create Graphich object to manipulate it. For
example,
> here is my test code:
> ==================================================
> Private Sub Output_Image(ByVal path As String)
> Try
> Dim img As Image = Image.FromFile(path)
> Dim stream As New System.IO.MemoryStream
> img.Save(stream, ImageFormat.Jpeg)
> Dim imgNew As Image = Image.FromStream(stream)
> Dim g As Graphics = Graphics.FromImage(imgNew)
> g.DrawString("MS Test", New Font("Verdana", 20,
> FontStyle.Bold), _
> New SolidBrush(Color.Beige), 0, 0)
> Response.Clear()
> Response.ContentType = "Image/jpeg"
> imgNew.Save(Response.OutputStream, ImageFormat.Jpeg)
> Response.End()
>
> img.Dispose()
> stream.Close()
> imgNew.Dispose()
> Catch ex As Exception
> Response.Write("<br>" + ex.Message)
> End Try
> End Sub
> =================================================
> Please have a try to see whether it works for you. Thanks.
> Regards,
> Steven Cheng
> Microsoft Online Support
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
> Get Preview at ASP.NET whidbey
> http://msdn.microsoft.com/asp.net/whidbey/default.aspx
Hi Richard,
As for the "A Graphics object cannot be created from an image that has an
indexed pixel format" error, it is caused by the Graphic object can't been
created from some certain image format which contains indexed pixel. I've
done some tests and one means is load the image and convert it into jpeg
format first and then create Graphich object to manipulate it. For example,
here is my test code:
==================================================
Private Sub Output_Image(ByVal path As String)
Try
Dim img As Image = Image.FromFile(path)
Dim stream As New System.IO.MemoryStream
img.Save(stream, ImageFormat.Jpeg)
Dim imgNew As Image = Image.FromStream(stream)
Dim g As Graphics = Graphics.FromImage(imgNew)
g.DrawString("MS Test", New Font("Verdana", 20,
FontStyle.Bold), _
New SolidBrush(Color.Beige), 0, 0)
Response.Clear()
Response.ContentType = "Image/jpeg"
imgNew.Save(Response.OutputStream, ImageFormat.Jpeg)
Response.End()
img.Dispose()
stream.Close()
imgNew.Dispose()
Catch ex As Exception
Response.Write("<br>" + ex.Message)
End Try
End Sub
=================================================
Please have a try to see whether it works for you. Thanks.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
System.FormatException: Input string was not in a correct format
I'm looking for a long time to find out what's wrong, but I can't find the mistake...
The connection to the database works correctly (Select,..), but when I set up the Insert-Command by clicking a button I get the following exception. Does anybody can help me and tell me what's wrong?!
Thank you for helping!
Exception:
System.FormatException: Input string was not in a correct format. at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) at System.String.System.IConvertible.ToInt32(IFormatProvider provider) at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider) at System.Data.OleDb.OleDbParameter.GetParameterValue() at System.Data.OleDb.OleDbParameter.GetParameterScale() at System.Data.OleDb.OleDbParameter.BindParameter(Int32 i, DBBindings bindings, tagDBPARAMBINDINFO[] bindInfo) at System.Data.OleDb.OleDbCommand.CreateAccessor() at System.Data.OleDb.OleDbCommand.InitializeCommand(CommandBehavior behavior, Boolean throwifnotsupported) at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteNonQuery() at roomplaner.ObjektHinzu.Anlegen_Click(Object sender, EventArgs e) in C:\Inetpub\...\ObjektHinzu.aspx.vb:line 107
line 107 --> Command.ExecuteNonQuery()
The error is associated with a call to System.Number.ParseInt32(). That tells me that one of the parameters is expected to contain an integer or a string representation of an integer but does not. Identify integer parameters. Then in the debugger, determine if any of them are:
Dim Command As New OleDbCommand'create OleDb database connection
Dim SQL_CONNECTION_STRING As String = "Provider=SQLOLEDB;Server=...;...."
Command.Connection = New OleDbConnection(SQL_CONNECTION_STRING)'create SQL statement for INSERT into table
Command.CommandText = "INSERT INTO t_object (Name, ObjectType, Category, Manufactor, Length, Width, Height, Text_Short, Text_Long, URL_Pic_Small, URL_Pic_Big, URL_Pic_Plan, URL_VET, VET_ObjectName, Material, Color, Price, ObjectLink, Comment, MaxSceneCount) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
Command.CommandType = CommandType.Text'add input parameters and values to INSERT statement
Command.Parameters.Add("@dotnet.itags.org.Name", OleDbType.VarChar, 100).Value = O_Name.Text
Command.Parameters.Add("@dotnet.itags.org.ObjectType", OleDbType.BigInt, 8).Value = O_ObjectType.SelectedValue
Command.Parameters.Add("@dotnet.itags.org.Category", OleDbType.BigInt, 8).Value = O_Category.SelectedValue
Command.Parameters.Add("@dotnet.itags.org.Manufactor", OleDbType.BigInt, 8).Value = O_Manufactor.SelectedValue
Command.Parameters.Add("@dotnet.itags.org.Length", OleDbType.Integer, 4).Value = O_Length.Text
Command.Parameters.Add("@dotnet.itags.org.Width", OleDbType.Integer, 4).Value = O_Width.Text
Command.Parameters.Add("@dotnet.itags.org.Height", OleDbType.Integer, 4).Value = O_Height.Text
Command.Parameters.Add("@dotnet.itags.org.Text_Short", OleDbType.VarChar, 100).Value = O_Text_Short.Text
Command.Parameters.Add("@dotnet.itags.org.Text_Long", OleDbType.VarChar, 500).Value = O_Text_Long.TextCommand.Parameters.Add("@dotnet.itags.org.URL_Pic_Small", OleDbType.VarChar, 100).Value = "0"
Command.Parameters.Add("@dotnet.itags.org.URL_Pic_Big", OleDbType.VarChar, 100).Value = "0"
Command.Parameters.Add("@dotnet.itags.org.URL_Pic_Plan", OleDbType.VarChar, 100).Value = "0"Command.Parameters.Add("@dotnet.itags.org.URL_VET", OleDbType.VarChar, 100).Value = "0"
Command.Parameters.Add("@dotnet.itags.org.VET_ObjectName", OleDbType.VarChar, 50).Value = O_VET_ObjectName.Text
Command.Parameters.Add("@dotnet.itags.org.Material", OleDbType.BigInt, 8).Value = O_Material.SelectedValue
Command.Parameters.Add("@dotnet.itags.org.Color", OleDbType.BigInt, 8).Value = O_Color.SelectedValue
Command.Parameters.Add("@dotnet.itags.org.Price", OleDbType.VarChar, 50).Value = O_Price.Text
Command.Parameters.Add("@dotnet.itags.org.ObjectLink", OleDbType.VarChar, 100).Value = O_ObjectLink.Text
Command.Parameters.Add("@dotnet.itags.org.Comment", OleDbType.VarChar, 100).Value = O_Comment.Text
Command.Parameters.Add("@dotnet.itags.org.MaxSceneCount", OleDbType.Integer, 4).Value = O_MaxSceneCount.TextTry
Command.Connection.Open()
Command.ExecuteNonQuery() 'save recordCatch ex As Exception
Response.Write("Exception:")
Response.Write(ex.ToString)
End TryCommand.Connection.Close()
End Sub
1. Not assigned. If a string is provided, is it an empty string?
2. Contains other characters than digits?
These two cases will generate that exception. (The .net docs for Convert.ToInt32 say FormatException will occur when:value does not consist of an optional sign followed by a sequence of digits (zero through nine).)
Monday, March 26, 2012
System.Net.Mail force or set send time/delay
Hi
Is it possible to when creating and sending an email in .NET 2.0 to specify the time you want it sent. Just like in Outlook, you can say, deliver on "Date @dotnet.itags.org. Time".
Looked at VS IDE and no options are given.
Thanks
Anthony
No, scheduled emails requires an application that stays alive for the duration of the schedule, and the .NET framework can't be responsible for such tasks.
You will have to take care of the scheduling and sending yourself, e.g by storing the email in a database and have a running process (a Windows Service) that continually polls the database and checks if there's something to send.
Saturday, March 24, 2012
System.NullReferenceException
system.nullreferenceexception every time i click button to add data to
datatable
here below is my code :
Dim wykszt as System.Data.DataTable
Dim zatru as System.Data.DataTable
Private Sub Page_Load(s As Object, e As EventArgs)
if Not IsPostBack Then
make_d_tables()
End if
End Sub
sub make_d_tables()
wykszt = New System.Data.DataTable("wykszt")
wykszt.Columns.Add("od_data", GetType(date))
wykszt.Columns.Add("do_data", GetType(date))
wykszt.Columns.Add("nazwa_szkoly", GetType(String))
wykszt.Columns.Add("nazwa_tytulu", GetType(String))
zatru = New System.Data.DataTable("zatr")
zatru.Columns.Add("od_data", GetType(date))
zatru.Columns.Add("do_data", GetType(date))
zatru.Columns.Add("nazwa_prac", GetType(String))
zatru.Columns.Add("nazwa_stan", GetType(String))
End sub
Sub Button2_Click(sender As Object, e As EventArgs)
row = wykszt.NewRow
row("od_data")=TextBox27.Text + "-01"
row("do_data")=TextBox28.Text + "-01"
row("nazwa_szkoly")=TextBox29.Text
row("nazwa_tytulu")=TextBox30.Text
wykszt.Rows.Add(row)
row = wykszt.NewRow
Mxdatagrid1.datasource=wykszt
Mxdatagrid1.databind
End Sub
Thanks
PatYou have to recreate your tables every time. So take out the if statement
from page_load.
"ven" <venome_@.poczta.onet.pl> wrote in message
news:cif6p8$sf3$1@.news.onet.pl...
> How must i declare my variables to have this code work. I get
> system.nullreferenceexception every time i click button to add data to
> datatable
> here below is my code :
> Dim wykszt as System.Data.DataTable
> Dim zatru as System.Data.DataTable
> Private Sub Page_Load(s As Object, e As EventArgs)
> if Not IsPostBack Then
> make_d_tables()
> End if
> End Sub
> sub make_d_tables()
> wykszt = New System.Data.DataTable("wykszt")
> wykszt.Columns.Add("od_data", GetType(date))
> wykszt.Columns.Add("do_data", GetType(date))
> wykszt.Columns.Add("nazwa_szkoly", GetType(String))
> wykszt.Columns.Add("nazwa_tytulu", GetType(String))
> zatru = New System.Data.DataTable("zatr")
> zatru.Columns.Add("od_data", GetType(date))
> zatru.Columns.Add("do_data", GetType(date))
> zatru.Columns.Add("nazwa_prac", GetType(String))
> zatru.Columns.Add("nazwa_stan", GetType(String))
> End sub
> Sub Button2_Click(sender As Object, e As EventArgs)
> row = wykszt.NewRow
> row("od_data")=TextBox27.Text + "-01"
> row("do_data")=TextBox28.Text + "-01"
> row("nazwa_szkoly")=TextBox29.Text
> row("nazwa_tytulu")=TextBox30.Text
> wykszt.Rows.Add(row)
> row = wykszt.NewRow
> Mxdatagrid1.datasource=wykszt
> Mxdatagrid1.databind
> End Sub
>
> Thanks
> Pat
>
Which line is throwing the exception?
Does the error only happen on postback?
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"ven" <venome_@.poczta.onet.pl> wrote in message
news:cif6p8$sf3$1@.news.onet.pl...
> How must i declare my variables to have this code work. I get
> system.nullreferenceexception every time i click button to add data to
> datatable
> here below is my code :
> Dim wykszt as System.Data.DataTable
> Dim zatru as System.Data.DataTable
> Private Sub Page_Load(s As Object, e As EventArgs)
> if Not IsPostBack Then
> make_d_tables()
> End if
> End Sub
> sub make_d_tables()
> wykszt = New System.Data.DataTable("wykszt")
> wykszt.Columns.Add("od_data", GetType(date))
> wykszt.Columns.Add("do_data", GetType(date))
> wykszt.Columns.Add("nazwa_szkoly", GetType(String))
> wykszt.Columns.Add("nazwa_tytulu", GetType(String))
> zatru = New System.Data.DataTable("zatr")
> zatru.Columns.Add("od_data", GetType(date))
> zatru.Columns.Add("do_data", GetType(date))
> zatru.Columns.Add("nazwa_prac", GetType(String))
> zatru.Columns.Add("nazwa_stan", GetType(String))
> End sub
> Sub Button2_Click(sender As Object, e As EventArgs)
> row = wykszt.NewRow
> row("od_data")=TextBox27.Text + "-01"
> row("do_data")=TextBox28.Text + "-01"
> row("nazwa_szkoly")=TextBox29.Text
> row("nazwa_tytulu")=TextBox30.Text
> wykszt.Rows.Add(row)
> row = wykszt.NewRow
> Mxdatagrid1.datasource=wykszt
> Mxdatagrid1.databind
> End Sub
>
> Thanks
> Pat
>
Uytkownik "Steve C. Orr [MVP, MCSD]" <Steve@.Orr.net> napisa w wiadomoci
news:OkGuVzNnEHA.1304@.TK2MSFTNGP09.phx.gbl...
> Which line is throwing the exception?
> Does the error only happen on postback?
> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
> http://Steve.Orr.net
>
> "ven" <venome_@.poczta.onet.pl> wrote in message
> news:cif6p8$sf3$1@.news.onet.pl...
>
sorry i left behind that i have Dim row as System.Data.DataRow in my
declarations too
but exception is only when i post back and
on this line :
row = wykszt.NewRow
and a full stack :
Szczegy wyjtku: System.NullReferenceException: Odwoanie do obiektu nie
zostao ustawione na wystpienie obiektu.
Bd rda:
Wiersz 35: Sub Button2_Click(sender As Object, e As EventArgs)
Wiersz 36:
Wiersz 37: row = wykszt.NewRow
Wiersz 38: row("od_data")=TextBox27.Text + "-01"
Wiersz 39: row("do_data")=TextBox28.Text + "-01"
Plik rdowy: c:\inetpub\wwwroot\axell\forma.aspx Wiersz: 37
lad stosu:
[NullReferenceException: Odwoanie do obiektu nie zostao ustawione na
wystpienie obiektu.]
ASP.forma_aspx.Button2_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\axell\forma.aspx:37
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePo
stBackEvent(String eventArgument) +58
System.Web.UI.Page. RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277
sorry for polish language
Thanks
Pat
In that case I agree with Marina.
You need to recreate your table upon each postback.
Right now you aren't doing that, so you can't add a row to a table that
doesn't exist, thus your error.
Remove the If statement in Page_Load.
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
> sorry i left behind that i have Dim row as System.Data.DataRow in my
> declarations too
> but exception is only when i post back and
> on this line :
> row = wykszt.NewRow
> and a full stack :
> Szczegy wyjtku: System.NullReferenceException: Odwoanie do obiektu nie
> zostao ustawione na wystpienie obiektu.
> Bd rda:
> Wiersz 35: Sub Button2_Click(sender As Object, e As EventArgs)
> Wiersz 36:
> Wiersz 37: row = wykszt.NewRow
> Wiersz 38: row("od_data")=TextBox27.Text + "-01"
> Wiersz 39: row("do_data")=TextBox28.Text + "-01"
>
> Plik rdowy: c:\inetpub\wwwroot\axell\forma.aspx Wiersz: 37
> lad stosu:
> [NullReferenceException: Odwoanie do obiektu nie zostao ustawione na
> wystpienie obiektu.]
> ASP.forma_aspx.Button2_Click(Object sender, EventArgs e) in
> c:\inetpub\wwwroot\axell\forma.aspx:37
> System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
> System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.Raise
Po
> stBackEvent(String eventArgument) +58
> System.Web.UI.Page. RaisePostBackEvent(IPostBackEventHandler
> sourceControl, String eventArgument) +18
> System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
> System.Web.UI.Page.ProcessRequestMain() +1277
> sorry for polish language
> Thanks
> Pat
>
System.NullReferenceException
system.nullreferenceexception every time i click button to add data to
datatable
here below is my code :
Dim wykszt as System.Data.DataTable
Dim zatru as System.Data.DataTable
Private Sub Page_Load(s As Object, e As EventArgs)
if Not IsPostBack Then
make_d_tables()
End if
End Sub
sub make_d_tables()
wykszt = New System.Data.DataTable("wykszt")
wykszt.Columns.Add("od_data", GetType(date))
wykszt.Columns.Add("do_data", GetType(date))
wykszt.Columns.Add("nazwa_szkoly", GetType(String))
wykszt.Columns.Add("nazwa_tytulu", GetType(String))
zatru = New System.Data.DataTable("zatr")
zatru.Columns.Add("od_data", GetType(date))
zatru.Columns.Add("do_data", GetType(date))
zatru.Columns.Add("nazwa_prac", GetType(String))
zatru.Columns.Add("nazwa_stan", GetType(String))
End sub
Sub Button2_Click(sender As Object, e As EventArgs)
row = wykszt.NewRow
row("od_data")=TextBox27.Text + "-01"
row("do_data")=TextBox28.Text + "-01"
row("nazwa_szkoly")=TextBox29.Text
row("nazwa_tytulu")=TextBox30.Text
wykszt.Rows.Add(row)
row = wykszt.NewRow
Mxdatagrid1.datasource=wykszt
Mxdatagrid1.databind
End Sub
Thanks
PatYou have to recreate your tables every time. So take out the if statement
from page_load.
"ven" <venome_@.poczta.onet.pl> wrote in message
news:cif6p8$sf3$1@.news.onet.pl...
> How must i declare my variables to have this code work. I get
> system.nullreferenceexception every time i click button to add data to
> datatable
> here below is my code :
> Dim wykszt as System.Data.DataTable
> Dim zatru as System.Data.DataTable
> Private Sub Page_Load(s As Object, e As EventArgs)
> if Not IsPostBack Then
> make_d_tables()
> End if
> End Sub
> sub make_d_tables()
> wykszt = New System.Data.DataTable("wykszt")
> wykszt.Columns.Add("od_data", GetType(date))
> wykszt.Columns.Add("do_data", GetType(date))
> wykszt.Columns.Add("nazwa_szkoly", GetType(String))
> wykszt.Columns.Add("nazwa_tytulu", GetType(String))
> zatru = New System.Data.DataTable("zatr")
> zatru.Columns.Add("od_data", GetType(date))
> zatru.Columns.Add("do_data", GetType(date))
> zatru.Columns.Add("nazwa_prac", GetType(String))
> zatru.Columns.Add("nazwa_stan", GetType(String))
> End sub
> Sub Button2_Click(sender As Object, e As EventArgs)
> row = wykszt.NewRow
> row("od_data")=TextBox27.Text + "-01"
> row("do_data")=TextBox28.Text + "-01"
> row("nazwa_szkoly")=TextBox29.Text
> row("nazwa_tytulu")=TextBox30.Text
> wykszt.Rows.Add(row)
> row = wykszt.NewRow
> Mxdatagrid1.datasource=wykszt
> Mxdatagrid1.databind
> End Sub
>
> Thanks
> Pat
Which line is throwing the exception?
Does the error only happen on postback?
--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"ven" <venome_@.poczta.onet.pl> wrote in message
news:cif6p8$sf3$1@.news.onet.pl...
> How must i declare my variables to have this code work. I get
> system.nullreferenceexception every time i click button to add data to
> datatable
> here below is my code :
> Dim wykszt as System.Data.DataTable
> Dim zatru as System.Data.DataTable
> Private Sub Page_Load(s As Object, e As EventArgs)
> if Not IsPostBack Then
> make_d_tables()
> End if
> End Sub
> sub make_d_tables()
> wykszt = New System.Data.DataTable("wykszt")
> wykszt.Columns.Add("od_data", GetType(date))
> wykszt.Columns.Add("do_data", GetType(date))
> wykszt.Columns.Add("nazwa_szkoly", GetType(String))
> wykszt.Columns.Add("nazwa_tytulu", GetType(String))
> zatru = New System.Data.DataTable("zatr")
> zatru.Columns.Add("od_data", GetType(date))
> zatru.Columns.Add("do_data", GetType(date))
> zatru.Columns.Add("nazwa_prac", GetType(String))
> zatru.Columns.Add("nazwa_stan", GetType(String))
> End sub
> Sub Button2_Click(sender As Object, e As EventArgs)
> row = wykszt.NewRow
> row("od_data")=TextBox27.Text + "-01"
> row("do_data")=TextBox28.Text + "-01"
> row("nazwa_szkoly")=TextBox29.Text
> row("nazwa_tytulu")=TextBox30.Text
> wykszt.Rows.Add(row)
> row = wykszt.NewRow
> Mxdatagrid1.datasource=wykszt
> Mxdatagrid1.databind
> End Sub
>
> Thanks
> Pat
Uytkownik "Steve C. Orr [MVP, MCSD]" <Steve@.Orr.net> napisa w wiadomoci
news:OkGuVzNnEHA.1304@.TK2MSFTNGP09.phx.gbl...
> Which line is throwing the exception?
> Does the error only happen on postback?
> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
> http://Steve.Orr.net
>
> "ven" <venome_@.poczta.onet.pl> wrote in message
> news:cif6p8$sf3$1@.news.onet.pl...
> > How must i declare my variables to have this code work. I get
> > system.nullreferenceexception every time i click button to add data to
> > datatable
> > here below is my code :
> > Dim wykszt as System.Data.DataTable
> > Dim zatru as System.Data.DataTable
> > Private Sub Page_Load(s As Object, e As EventArgs)
> > if Not IsPostBack Then
> > make_d_tables()
> > End if
> > End Sub
> > sub make_d_tables()
> > wykszt = New System.Data.DataTable("wykszt")
> > wykszt.Columns.Add("od_data", GetType(date))
> > wykszt.Columns.Add("do_data", GetType(date))
> > wykszt.Columns.Add("nazwa_szkoly", GetType(String))
> > wykszt.Columns.Add("nazwa_tytulu", GetType(String))
> > zatru = New System.Data.DataTable("zatr")
> > zatru.Columns.Add("od_data", GetType(date))
> > zatru.Columns.Add("do_data", GetType(date))
> > zatru.Columns.Add("nazwa_prac", GetType(String))
> > zatru.Columns.Add("nazwa_stan", GetType(String))
> > End sub
> > Sub Button2_Click(sender As Object, e As EventArgs)
> > row = wykszt.NewRow
> > row("od_data")=TextBox27.Text + "-01"
> > row("do_data")=TextBox28.Text + "-01"
> > row("nazwa_szkoly")=TextBox29.Text
> > row("nazwa_tytulu")=TextBox30.Text
> > wykszt.Rows.Add(row)
> > row = wykszt.NewRow
> > Mxdatagrid1.datasource=wykszt
> > Mxdatagrid1.databind
> > End Sub
> > Thanks
> > Pat
sorry i left behind that i have Dim row as System.Data.DataRow in my
declarations too
but exception is only when i post back and
on this line :
row = wykszt.NewRow
and a full stack :
Szczegy wyjtku: System.NullReferenceException: Odwoanie do obiektu nie
zostao ustawione na wystpienie obiektu.
Bd rda:
Wiersz 35: Sub Button2_Click(sender As Object, e As EventArgs)
Wiersz 36:
Wiersz 37: row = wykszt.NewRow
Wiersz 38: row("od_data")=TextBox27.Text + "-01"
Wiersz 39: row("do_data")=TextBox28.Text + "-01"
Plik rdowy: c:\inetpub\wwwroot\axell\forma.aspx Wiersz: 37
lad stosu:
[NullReferenceException: Odwoanie do obiektu nie zostao ustawione na
wystpienie obiektu.]
ASP.forma_aspx.Button2_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\axell\forma.aspx:37
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePo
stBackEvent(String eventArgument) +58
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277
sorry for polish language
Thanks
Pat
In that case I agree with Marina.
You need to recreate your table upon each postback.
Right now you aren't doing that, so you can't add a row to a table that
doesn't exist, thus your error.
Remove the If statement in Page_Load.
--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
> sorry i left behind that i have Dim row as System.Data.DataRow in my
> declarations too
> but exception is only when i post back and
> on this line :
> row = wykszt.NewRow
> and a full stack :
> Szczegy wyjtku: System.NullReferenceException: Odwoanie do obiektu nie
> zostao ustawione na wystpienie obiektu.
> Bd rda:
> Wiersz 35: Sub Button2_Click(sender As Object, e As EventArgs)
> Wiersz 36:
> Wiersz 37: row = wykszt.NewRow
> Wiersz 38: row("od_data")=TextBox27.Text + "-01"
> Wiersz 39: row("do_data")=TextBox28.Text + "-01"
>
> Plik rdowy: c:\inetpub\wwwroot\axell\forma.aspx Wiersz: 37
> lad stosu:
> [NullReferenceException: Odwoanie do obiektu nie zostao ustawione na
> wystpienie obiektu.]
> ASP.forma_aspx.Button2_Click(Object sender, EventArgs e) in
> c:\inetpub\wwwroot\axell\forma.aspx:37
> System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
> System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePo
> stBackEvent(String eventArgument) +58
> System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
> sourceControl, String eventArgument) +18
> System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
> System.Web.UI.Page.ProcessRequestMain() +1277
> sorry for polish language
> Thanks
> Pat
System.NullReferenceException
Hello people,
this is my first time ever to post a question on this asp.net forum, so I hope this would be a wonderful experience from here on.
Here is my problem, I get " System.NullReferenceException " this error at not a compile time, but atruntime time.
here is my code
protectedvoid dl_UpdateCommand(objectsource,DataListCommandEventArgs e)
{
// Read inthe ProductID from the DataKeys collection
intFileID =Convert.ToInt32(dl.DataKeys[e.Item.ItemIndex]);
// Readin the product name and price values
TextBoxtxtEditFileName = (TextBox)e.Item.FindControl("FileName");
TextBoxtxtEditDescription = (TextBox)e.Item.FindControl("Description");
stringFileNameValue =null;//"null" wil not work.Error Occurs here
if(txtEditFileName.Text.Trim().Length > 0)
FileNameValue =txtEditFileName.Text.Trim();
stringDescriptionValue =null;Error Occurs here
if(txtEditDescription.Text.Trim().Length > 0)
DescriptionValue =txtEditDescription.Text.Trim();
#region- "changed Updatemechanism"
// Call theUpdate method to Update FileName, Description...
SqlConnectionmyConnection =newSqlConnection(ConfigurationManager.ConnectionStrings["ARCCAOHelpConnectionString"].ConnectionString);
//stringsqlString = "SELECT * FROM ARCCA_FileUpload1 WHERE FileID=" + FileID;
stringsqlString ="SELECT * FROMARCCA_FileUpload1";
SqlDataAdapterdataAdapter =newSqlDataAdapter(sqlString,myConnection);
DataSetdataSet =newDataSet();
DataRowdataRow;
// Createcommand builder. This line automatically generates the update commands for you,so you don't
// have toprovide or create your own.
SqlCommandBuildersqlCmdBuild =newSqlCommandBuilder(dataAdapter);
// Set theMissingSchemaAction property to AddWithKey because Fill will not cause primary
// key &unique key information to be retrieved unless AddWithKey is specified.
dataAdapter.MissingSchemaAction =MissingSchemaAction.AddWithKey;
dataAdapter.Fill(dataSet,"ARCCA_FileUpload1");
dataRow = dataSet.Tables["ARCCA_FileUpload1"].NewRow();
dataRow["FileID"]=FileID;
dataRow["FileName"]=FileNameValue;
dataRow["Description"]=DescriptionValue;
dataSet.Tables["ARCCA_FileUpload1"].Rows.Add(dataRow);
// Revert theDataList back to its pre-editing state
dl.EditItemIndex = -1;
dl.DataBind();
}
now, how to fix it?
Set it to string.empty
SonuKapoor:
Set it to string.empty
i wonder why it shouldn't work ... setting a string to null works just fine with me ...
Trickass: You are right it should work with null as well.
eddieiam: Are you sure that this is line causing the error?
Hi Sonu,
the actual line thats causing the error isif (txtEditFileName.Text.Trim().Length > 0) . On this line, I get error: System.NullReferenceException: Object reference not set to an instance of an object
You have to make sure that the row contains a textbox with the id "FileName". Can you show me the HTML declaration of your GridView?
Anytime that you use FindControl, you should ALWAYS do a null check before using the control, as that is what you get if it doesn't find the control.
FindControl should always be used like this:
Control controlRef = e.Item.FindControl("FileName");
if ( controlRef != null )
{
TextBox txtEditFileName = (TextBox)controlRef;
// Remainder of processing for this TextBox...
}
Could be that "FileName" is not the correct ClientID for this control because of spelling, case-sensitivity, or that the control is inside of a container which changes the ClientID by adding on the container ClientID (masterPageID + "_" + controlID).
NC...
NC01: I have masterPage, but i am not assigning masterPageID to the control at the aspx page. Also, I've tried using the Control to FindControl it now gives me FileNameValue does not exist error
The easiest way to solve that is to bring the page up in your browser and do a View Source on it then find the control to see what the ending ClientID is.
NC...
Hold it! If this control is in a DataList, DataGrid, or GridView, etc, this should work, and could give you an idea of the problem.
protected void dl_UpdateCommand(object source, DataListCommandEventArgs e)
{
// Iterate through all controls on the row:
for (int i=0; i<e.Item.Controls.Count; i++)
{
Control controlRef = e.Item.Controls[i];
string controlId = string.Empty;
if ( controlRef is LinkButton )
controlId = ((LinkButton)controlRef).ClientID;
else if ( controlRef is Label )
controlId = ((Label)controlRef).ClientID;
else if ( controlRef is TextBox )
controlId = ((TextBox)controlRef).ClientID;
// else any other controls here
}
}
NC...
Hey uh, you good!. thanks for your effort in helping me. really do appriciate. but still i get the same error buddy. By the way, its a DataList that I am binding to. And
using the Edit template to edit. let me also post the aspx page for ref which will be down below after the cs code.
thanks.. again..
protected void dl_UpdateCommand(object source, DataListCommandEventArgs e)
{
//Iterate through all controls on the row:
// Iterate through all controls on the row:
for (int i = 0; i < e.Item.Controls.Count; i++)
{
Control controlRef = e.Item.Controls[i];
string controlId = string.Empty;
if (controlRef is LinkButton)
controlId = ((LinkButton)controlRef).ClientID;
else if (controlRef is Label)
controlId = ((Label)controlRef).ClientID;
else if (controlRef is TextBox)
controlId = ((TextBox)controlRef).ClientID;
// else any other controls here
}
// Read in the ProductID from the DataKeys collection
int FileID = Convert.ToInt32(dl.DataKeys[e.Item.ItemIndex]);
// Read in the product name and price values
TextBox txtEditFileName = (TextBox)e.Item.FindControl("FileName");
TextBox txtEditDescription = (TextBox)e.Item.FindControl("Description");
string FileNameValue = null; // "null" wil not work.
if (txtEditFileName.Text.Trim().Length > 0)
FileNameValue = txtEditFileName.Text.Trim();
string DescriptionValue = null;
if (txtEditDescription.Text.Trim().Length > 0)
DescriptionValue = txtEditDescription.Text.Trim();
#region- "changed Update mechanism"
// Call the Update method to Update FileName, Description...
SqlConnection myConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["ARCCAOHelpConnectionString"].ConnectionString);
//string sqlString = "SELECT * FROM ARCCA_FileUpload1 WHERE FileID=" + FileID;
string sqlString = "SELECT * FROM ARCCA_FileUpload1";
SqlDataAdapter dataAdapter = new SqlDataAdapter(sqlString,myConnection);
DataSet dataSet = new DataSet();
DataRow dataRow;
// Create command builder. This line automatically generates the update commands for you, so you don't
// have to provide or create your own.
SqlCommandBuilder sqlCmdBuild = new SqlCommandBuilder(dataAdapter);
// Set the MissingSchemaAction property to AddWithKey because Fill will not cause primary
// key & unique key information to be retrieved unless AddWithKey is specified.
dataAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
dataAdapter.Fill(dataSet,"ARCCA_FileUpload1");
dataRow = dataSet.Tables["ARCCA_FileUpload1"].NewRow();
dataRow["FileID"]=FileID;
dataRow["FileName"]= FileNameValue;
dataRow["Description"]= DescriptionValue;
dataSet.Tables["ARCCA_FileUpload1"].Rows.Add(dataRow);
// Revert the DataList back to its pre-editing state
dl.EditItemIndex = -1;
dl.DataBind();
#endregion
#region- "obselete Update mechanism"
//// Call the Update method to Update FileName, Description...
//using (SqlConnection myConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["ARCCAOHelpConnectionString"].ConnectionString))
//{
// myConnection.Open();
// string conString = "UPDATE ARCCA_FileUpload1 SET FileName ='txtEditFileName', Description ='txtEditDescription' WHERE FileID=" + FileID;
// using (SqlCommand cmd = new SqlCommand(conString, myConnection))
// {
// cmd.Connection.Open();
// SqlDataAdapter da = new SqlDataAdapter();
// da.UpdateCommand = cmd;
// DataSet dataSet = new DataSet();
// da.Fill(dataSet);
// }
//}
//// Revert the DataList back to its pre-editing state
//dl.EditItemIndex = -1;
//dl.DataBind();
#endregion
}
protected void dl_CancelCommand(object source, DataListCommandEventArgs e)
{
// Set the DataList's EditItemIndex property to -1
dl.EditItemIndex = -1;
// Rebind the data to the DataList
dl.DataBind();
}
<%@. Page Language="C#" MasterPageFile="~/ARCCAAccess.master" AutoEventWireup="true" CodeFile="TestPage.aspx.cs" Inherits="TestPage" Title="Untitled Page" %
<%@. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:DataList runat="server" ID="dl" DataKeyField="FileID"
OnItemCommand="dl_ItemCommand"
OnEditCommand="dl_EditCommand" OnDeleteCommand="dl_DeleteCommand"
OnUpdateCommand="dl_UpdateCommand" OnCancelCommand="dl_CancelCommand" >
<ItemTemplate>
<cc1:HoverMenuExtender ID="HoverMenuExtender1" runat="server" TargetControlID="HypLnkFileName"
PopupControlID="Panel1" PopupPosition="Right" OffsetX="6" PopDelay="25" HoverCssClass="popupHover">
</cc1:HoverMenuExtender>
<asp:Panel ID="Panel1" runat="server" BackColor="White" BorderColor="Blue" BorderStyle="Solid"
BorderWidth="1px" CssClass="popupMenu" Width="350px" >
<asp:Label ID="lblDescription" ForeColor="black" Font-Size="14px"
runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Description") %>'></asp:Label>
<asp:LinkButton ID="btnEdit" runat="server" CausesValidation="true" CommandName="Edit">Edit</asp:LinkButton>
<asp:LinkButton ID="btnDelete" runat="server" CommandName="Delete">Delete</asp:LinkButton>
</asp:Panel>
<asp:LinkButton ID="HypLnkFileName" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "FileName") %>'></asp:LinkButton>
</ItemTemplate>
<EditItemTemplate>
<asp:Panel ID="Panel2" runat="server" BackColor="White" BorderColor="Blue" BorderStyle="Solid"
BorderWidth="1px" CssClass="popupMenu" Width="500px">
FileName :<asp:TextBox ID="txtEditFileName" Text='<%# DataBinder.Eval(Container.DataItem, "FileName") %>'
runat="server" ></asp:TextBox>
Description :<asp:TextBox ID="txtEditDescription" Text='<%# DataBinder.Eval(Container.DataItem, "Description") %>'
runat="server" Width="175px"></asp:TextBox>
<asp:LinkButton ID="btnUpdate" Text="Update" ForeColor="Red" CommandName="Update"
runat="server"></asp:LinkButton>
<asp:LinkButton ID="btnCancel" Text="Cancel" ForeColor="Red" CommandName="Cancel"
runat="server"></asp:LinkButton>
</asp:Panel>
</EditItemTemplate>
</asp:DataList>
</asp:Content
Try this:
Panel p = (Panel)e.Item.FindControl("Panel2");
TextBox txtEditDescription = (TextBox)p.FindControl("Description");
Try what SonuKapoor posted because txtEditFileName and txtEditDescription are definitely inside of the Panel2 container, so the ClientID would probably be dl_Panel2_txtEditFileName. So even the code that I gave you to test with wouldn't pick them up I don't think. It would only pickup HoverMenuExtender1, Panel1, HypLnkFileName, and Panel2 (I believe).
This should work for the FileName TextBox:
Panel p = (Panel)e.Item.FindControl("Panel2");
TextBox txtEditFileName = (TextBox)p.FindControl("txtEditFileName");
NC...
I don't think that you would need the ClientID anyways.
I was thinking if I need to place the contentPlaceHolder Id with FindControl to make it work. since I had a similar problem while adding export to excel some documents from web.
Tuesday, March 13, 2012
System.Security.SecurityException: Requested registry access is not allowed.
To this notion, Windows says: System.Security.SecurityException: Requested registry access is not allowed.
You have GOT to be kidding me...
Here's a snipped stack trace:
[SecurityException: Requested registry access is not allowed.]
System.ThrowHelper.ThrowSecurityException(ExceptionResource resource) +48
Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable) +2780649
System.Diagnostics.EventLog.CreateEventSource(EventSourceCreationData sourceData) +360
System.Diagnostics.EventLog.CreateEventSource(String source, String logName) +41
It should be pretty obvious what I'm trying to do. What security settings must I change to allow my ASP.NET application to create this EventLog source and subsequently write log events?
Thanks for any help,
You have to give the ASP.NET porcess account access to modify the event log entries. There are a number of KB articles about this and related issues. Might start here:
http://support.microsoft.com/default.aspx?scid=kb;en-us;842795
Jeff
Cool, thanks! :)
ASTECH:
You have GOT to be kidding me...
Wow, so you'd be cool that the Windows Registry gave access to running code by default?
Can you image the havok created if someone had a third party dll in their web project or some other made-with-.NET programming running that was reading and reporting EventLog details back to some remote server somewhere?
Explicitly setting the permission is absolutely the best route there.... protects programmeres/end-users fromthemselves
Do you expect a reply to that? If you're really begging for a reply to that, here: "I couldn't care less."
The EventLog is the central logging facility for Windows. Duh? Let my .NET applications write entries without bothering me with these overly paranoid, annoying details. This has just been one more delay in what should have been an easy development cycle...
By the way: "If you don't have anything nice to say or constructive to add, KEEP IT SHUT!"
There's a definite security concern with allowing the .NET process to write to the Windows event logs. The proper method would be to create your own event log for your app and write to that. In all cases never allow access to the secuirty log, makes it too easy to cover your tracks when you're hacking.
As long as you're comfortable with allowing the access, it's fine with us. If you wish to avoid further delays in your development cycle due to security issues, I suggest you make the group Everyone a local administrator and change all your processes to use the Administrator account. That way you pretty much won't be pestered by security issues in your coding.
Jeff
jeff@.zina.com:
If you wish to avoid further delays in your development cycle due to security issues, I suggest you make the group Everyone a local administrator and change all your processes to use the Administrator account. That way you pretty much won't be pestered by security issues in your coding.
Jeff
Now that's funny! What a blissful world we'd all live in if everyone everywhere did exactly that! (tongue in cheek)