[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Null value into an integer variable


I saw in the source code of GRIDVIEW:
Public Sub _GetRowText(iRow As Integer) As String
  
   Dim sText As String
  
   If $cText Then sText = $cText[iRow]
   If Not sText Then sText = CStr(iRow + 1)
   Return sText
  
End

I'm trying to make each row at the top of the vertical a different color:
Public Sub _GetRowForeground(iRow As Integer) As Integer
  
   Dim iForeground As Integer
  
   If $iForeground Then iForeground = $iForeground[iRow]
  
End
And there is a case that: $iForeground[iRow] does not exist and is NULL and then I wanted it to set a value of 0

But in the end I came to the conclusion that it is better if if is NULL
which will insert the main color set on all the rows

By the way.
I didn't understand what you mean:
By the way, you are hereby charged with thread stealing and will be
  tried and summarily executed

Thanks


---------- Original Message -----------
From: BB <adamnt42@xxxxxxxxx>
To: user@xxxxxxxxxxxxxxxxxxxxxx
Sent: Fri, 19 Apr 2024 18:50:31 +0930
Subject: Re: Null value into an integer variable

> On 19/4/24 6:25 pm, Mayost Sharon wrote:
> 
> > Hello
> >
> >
> > Public Sub Main()
> >    
> >    Dim sVar As String
> >    Dim iVar As Integer
> >
> >    sVar = "gb"
> >    iVar = 3
> >    
> >    sVar = Null
> >    iVar = Null
> >    
> > End
> >
> >
> > When I put an Null value into a variable of type string I don't get an error and the variable gets a value of ""
> >
> > But when I put an Null value into a variable of integer type it gives an error
> >
> > Is this normal?
> >
> > Thank you
> >
> >
> Very much so! A string of zero length is considered a null or vice versa 
> a null is considered a string of zero length. But consider the internal 
> (memory) representation of an integer. There is no way to represent a 
> null value.
> 
> This is of course a big PIA when dealing with databases where integer 
> columns can contain nulls and that has a very specific meaning i.e. "no 
> value has been set". I have to date, after some time considering this, 
> have not arrived at a viable solution.
> 
> Why do you want to set an integer variable to Null?
> 
> b
------- End of Original Message -------


References:
GRIDVIEW color and size"Mayost Sharon" <sharon@xxxxxxxxx>
Re: GRIDVIEW color and sizeT Lee Davidson <t.lee.davidson@xxxxxxxxx>
Re: GRIDVIEW color and sizeT Lee Davidson <t.lee.davidson@xxxxxxxxx>
Re: GRIDVIEW color and size"Mayost Sharon" <sharon@xxxxxxxxx>
Re: GRIDVIEW color and sizeT Lee Davidson <t.lee.davidson@xxxxxxxxx>
Null value into an integer variable"Mayost Sharon" <sharon@xxxxxxxxx>
Re: Null value into an integer variableBB <adamnt42@xxxxxxxxx>