Article View: chile.comp.programacion
Article #2513Re: Validar RUT en vb.net
From: RobertoCL
Date: Fri, 02 Dec 2005 18:11
Date: Fri, 02 Dec 2005 18:11
48 lines
2282 bytes
2282 bytes
"Hugo A." <terreno2002PLEASENOSPAM@hotmail.com> escribi� en el mensaje
news:dmq0oi$top$1@news.nivel5.cl...
>y c�mo es el c�lculo matem�tico para verificar el d�gito ?
El sue�o de anoche me impidi� buscar bien :)
Public Function RutDigito(ByVal Rut As Long) As String
Dim Digito As Integer
Dim Contador As Integer
Dim Multiplo As Integer
Dim Acumulador As Integer
Contador = 2
Acumulador = 0
While Rut <> 0
Multiplo = (Rut Mod 10) * Contador
Acumulador = Acumulador + Multiplo
Rut = Rut \ 10
Contador = Contador + 1
If Contador = 8 Then
Contador = 2
End If
Wend
Digito = 11 - (Acumulador Mod 11)
RutDigito = CStr(Digito)
If Digito = 10 Then RutDigito = "K"
If Digito = 11 Then RutDigito = "0"
End Function
http://www.dcc.uchile.cl/~mortega/ortega.cl/validarrut/visual_basic.html
--
RCL
> "RobertoCL" <rcl2020NOSPAM@hotmail.com> escribi� en el mensaje
> news:dmoh5p$6q0$1@news.nivel5.cl...
>> Alguien tendr� entre sus cachureos la clase, o el modulo o la funci�n
>> para validar el RUT, en visual basic .net para que la postee por favor.
>> Supongo que la funci�n en vb6 sirve, la tenia pero se me perdi�.
>>
>> --
>> RCL
>>
>>
>>
>
>
Technical Details
Message-ID:
<dmq2j2$6c2$1@proxy.ifxnw.cl>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news.kjsl.com!news.nivel5.cl!news2.ifxnw.cl!not-for-mailReferences:
<dmoh5p$6q0$1@news.nivel5.cl> <dmq0oi$top$1@news.nivel5.cl>Show Full Headers
Complete Article Headers
X-Google-Thread: 1593cb,1bbc6fb810afa28 X-Google-Attributes: gid1593cb,public X-Google-Language: SPANISH,ASCII Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news.kjsl.com!news.nivel5.cl!news2.ifxnw.cl!not-for-mail From: "RobertoCL" <rcl2020NOSPAM@hotmail.com> Newsgroups: chile.comp.programacion Subject: Re: Validar RUT en vb.net Date: Fri, 2 Dec 2005 15:11:14 -0300 Organization: IFX Networks News Server Lines: 50 Message-ID: <dmq2j2$6c2$1@proxy.ifxnw.cl> References: <dmoh5p$6q0$1@news.nivel5.cl> <dmq0oi$top$1@news.nivel5.cl> NNTP-Posting-Host: 200.73.30.63 X-Trace: proxy.ifxnw.cl 1133546914 6530 200.73.30.63 (2 Dec 2005 18:08:34 GMT) X-Complaints-To: abuse@ifxnetworks.com NNTP-Posting-Date: Fri, 2 Dec 2005 18:08:34 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2527 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 X-RFC2646: Format=Flowed; Response