Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
asad
Starting Member
16 Posts |
Posted - 2006-08-28 : 01:16:13
|
i have a string...in which i am passing a value just like that:dim strHeader as string strHeader &= ".header {" & vbCrLf & _ "background-color:" & bgColor & vbCrLf & _ "color:" & foreColor & vbCrLf & _ "font-family:" & fontName & vbCrLf & _ "font-Size:" & fontSize & vbCrLf & _ "font-weight:" & fontType & vbCrLf & _ "height:" & height & vbCrLf & _ "}" & vbCrLf & vbCrLfbut warning occured that is variable strHeader is used before it has been assigned a value a null reference exception could result at run time...is there any way to remove this warning.asad |
|
timmy
Master Smack Fu Yak Hacker
1242 Posts |
Posted - 2006-08-28 : 01:26:32
|
you should initialise it first.Just replace the '&=' in the second line with '='Otherwise it doesn't know what to concatenate to. |
 |
|
asad
Starting Member
16 Posts |
Posted - 2006-08-28 : 02:07:11
|
thanx timmy... i solve it by using null valueasad |
 |
|
timmy
Master Smack Fu Yak Hacker
1242 Posts |
Posted - 2006-08-28 : 02:29:52
|
have you tried using the String.Format method?It would make that bit of code much cleaner. And more maintainable |
 |
|
|
|
|