<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>solocodigofuente.com .:. ejemplos de codigo fuente de visual basic .net 2005 2008, Power Builder, Sql server</title>
	<atom:link href="http://solocodigofuente.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://solocodigofuente.com</link>
	<description>de cero al infinito...</description>
	<lastBuildDate>Sun, 26 Feb 2012 00:21:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Convertir número decimal a otro sistema de numeración en vb. net</title>
		<link>http://solocodigofuente.com/ejemplos-de-codigo-fuente-en-visual-basic-net/convertir-numero-decimal-a-otro-sistema-de-numeracion-en-vb-net/</link>
		<comments>http://solocodigofuente.com/ejemplos-de-codigo-fuente-en-visual-basic-net/convertir-numero-decimal-a-otro-sistema-de-numeracion-en-vb-net/#comments</comments>
		<pubDate>Sun, 26 Feb 2012 00:21:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Visual Basic .NET]]></category>
		<category><![CDATA[binario]]></category>
		<category><![CDATA[decimal]]></category>
		<category><![CDATA[numeracion]]></category>
		<category><![CDATA[sistema]]></category>

		<guid isPermaLink="false">http://solocodigofuente.com/?p=531</guid>
		<description><![CDATA[Código fuente para convertir un número en base 10 a otro sistema de numeración (mayor a 1 y menor a 10).



Private Sub bConvertir_Click&#40;ByVal sender As System.Object, ByVal e As System.EventArgs&#41; Handles bConvertir.Click
        Dim numdecimal As Integer = TextBox1.Text
        Dim numbasenueva As [...]]]></description>
			<content:encoded><![CDATA[<p>Código fuente para convertir un número en base 10 a otro sistema de numeración (mayor a 1 y menor a 10).</p>
<p><a href="http://solocodigofuente.com/wp-content/uploads/2012/02/binario_vb.png"><img class="alignnone size-full wp-image-532" title="binario_vb" src="http://solocodigofuente.com/wp-content/uploads/2012/02/binario_vb.png" alt="" width="300" height="235" /></a></p>
<p><span id="more-531"></span></p>

<div class="wp_syntax"><div class="code"><pre class="vbnet" style="font-family:monospace;"><span style="color: #FF8000;">Private</span> <span style="color: #0600FF;">Sub</span> bConvertir_Click<span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> sender <span style="color: #FF8000;">As</span> System.<span style="color: #FF0000;">Object</span>, <span style="color: #FF8000;">ByVal</span> e <span style="color: #FF8000;">As</span> System.<span style="color: #0000FF;">EventArgs</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">Handles</span> bConvertir.<span style="color: #0000FF;">Click</span>
        <span style="color: #0600FF;">Dim</span> numdecimal <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span> <span style="color: #008000;">=</span> TextBox1.<span style="color: #0000FF;">Text</span>
        <span style="color: #0600FF;">Dim</span> numbasenueva <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Integer</span> <span style="color: #008000;">=</span> TextBox2.<span style="color: #0000FF;">Text</span>
        <span style="color: #0600FF;">Dim</span> r <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span> <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;&quot;</span>
        <span style="color: #0600FF;">Do</span>
            r <span style="color: #008000;">=</span> <span style="color: #000000;">&#40;</span>numdecimal <span style="color: #804040;">Mod</span> numbasenueva<span style="color: #000000;">&#41;</span> <span style="color: #008000;">&amp;</span> r
            numdecimal <span style="color: #008000;">=</span> numdecimal <span style="color: #008000;">\</span> numbasenueva
        <span style="color: #0600FF;">Loop</span> Until <span style="color: #000000;">&#40;</span>numdecimal <span style="color: #008000;">\</span> numbasenueva<span style="color: #000000;">&#41;</span> &lt;<span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span>
        r <span style="color: #008000;">=</span> <span style="color: #000000;">&#40;</span>numdecimal <span style="color: #804040;">Mod</span> numbasenueva<span style="color: #000000;">&#41;</span> <span style="color: #008000;">&amp;</span> r
        Label3.<span style="color: #0000FF;">Text</span> <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;Respuesta en base &quot;</span> <span style="color: #008000;">&amp;</span> numbasenueva <span style="color: #008000;">&amp;</span> <span style="color: #808080;">&quot; : &quot;</span> <span style="color: #008000;">&amp;</span> r
    <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://solocodigofuente.com/ejemplos-de-codigo-fuente-en-visual-basic-net/convertir-numero-decimal-a-otro-sistema-de-numeracion-en-vb-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Llenar datos a un listbox desde una base de datos sql server en PowerBuilder 11.5</title>
		<link>http://solocodigofuente.com/ejemlos-de-codigos-fuente-en-power-builder/llenar-datos-a-un-listbox-desde-una-base-de-datos-sql-server/</link>
		<comments>http://solocodigofuente.com/ejemlos-de-codigos-fuente-en-power-builder/llenar-datos-a-un-listbox-desde-una-base-de-datos-sql-server/#comments</comments>
		<pubDate>Mon, 06 Feb 2012 06:06:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Power Builder]]></category>
		<category><![CDATA[cursores]]></category>
		<category><![CDATA[fetch]]></category>
		<category><![CDATA[Listbox]]></category>

		<guid isPermaLink="false">http://solocodigofuente.com/?p=526</guid>
		<description><![CDATA[Para obtener el resultado esperado crearemos un cursor, el cual almacenará la data obtenida de la base de datos.

Previamente debemos de realizar la conexion a la base de datos sqlserver


integer total_registro
string nombre
&#160;
DECLARE c_producto CURSOR FOR
select descripcion from productos;
select count&#40;*&#41; INTO :total_registro from productos;
&#160;
OPEN c_producto;
integer indice
for indice=1 to total_registro
	FETCH NEXT c_producto INTO :nombre;
	lb_1.insertitem&#40; nombre, indice&#41;
next
CLOSE c_producto;

]]></description>
			<content:encoded><![CDATA[<p>Para obtener el resultado esperado crearemos un cursor, el cual almacenará la data obtenida de la base de datos.</p>
<p><img class="alignnone size-full wp-image-527" title="listbox en powerbuilder" src="http://solocodigofuente.com/wp-content/uploads/2012/02/LB.png" alt="listbox" width="217" height="300" /></p>
<p>Previamente debemos de realizar la <a href="http://solocodigofuente.com/ejemlos-de-codigos-fuente-en-power-builder/conexion-desde-power-builder-105-a-una-base-de-datos-sql-server-2005/" target="_self">conexion </a>a la base de datos sqlserver</p>
<p><span id="more-526"></span></p>

<div class="wp_syntax"><div class="code"><pre class="pb105" style="font-family:monospace;"><span style="color: #800080;">integer</span> total_registro
<span style="color: #800080;">string</span> nombre
&nbsp;
<span style="color: #008000;">DECLARE</span> c_producto CURSOR <span style="color: #008000;">FOR</span>
<span style="color: #0600FF;">select</span> descripcion from productos;
<span style="color: #0600FF;">select</span> count<span style="color: #000000;">&#40;</span><span style="color: #000000;">*</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">INTO</span> :total_registro from productos;
&nbsp;
<span style="color: #008000;">OPEN</span> c_producto;
<span style="color: #800080;">integer</span> indice
<span style="color: #008000;">for</span> indice<span style="color: #000000;">=</span><span style="color: #000080;">1</span> <span style="color: #008000;">to</span> total_registro
	<span style="color: #008000;">FETCH</span> <span style="color: #008000;">NEXT</span> c_producto <span style="color: #008000;">INTO</span> :nombre;
	lb_1.<span style="color: #000000;">insertitem</span><span style="color: #000000;">&#40;</span> nombre, indice<span style="color: #000000;">&#41;</span>
<span style="color: #008000;">next</span>
<span style="color: #008000;">CLOSE</span> c_producto;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://solocodigofuente.com/ejemlos-de-codigos-fuente-en-power-builder/llenar-datos-a-un-listbox-desde-una-base-de-datos-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fomar un triangulo con los numeros en JAVA</title>
		<link>http://solocodigofuente.com/jdeveloper/fomar-un-triangulo-con-los-numeros-en-java-usando-jdeveloper/</link>
		<comments>http://solocodigofuente.com/jdeveloper/fomar-un-triangulo-con-los-numeros-en-java-usando-jdeveloper/#comments</comments>
		<pubDate>Mon, 09 May 2011 19:14:37 +0000</pubDate>
		<dc:creator>quihuinet</dc:creator>
				<category><![CDATA[JDeveloper]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[List1]]></category>
		<category><![CDATA[triangulo]]></category>

		<guid isPermaLink="false">http://solocodigofuente.com/?p=522</guid>
		<description><![CDATA[
Controles: SWING[Jlabel1,JTextField,JButton], AWT(List1)


    private void jButton1_actionPerformed&#40;ActionEvent e&#41; &#123;
        int n=Integer.parseInt&#40;jTextField1.getText&#40;&#41;&#41;;
        String fila=&#34;&#34;;
        for &#40;int x=1; x &#60;= n; x++&#41;
        &#123;   int s=0;
 [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://solocodigofuente.com/wp-content/uploads/2011/05/triangulo.png"><img class="alignnone size-full wp-image-523" title="triangulo con numero en java" src="http://solocodigofuente.com/wp-content/uploads/2011/05/triangulo.png" alt="" width="338" height="287" /></a></p>
<p>Controles: SWING[Jlabel1,JTextField,JButton], AWT(List1)<br />
<span id="more-522"></span></p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> jButton1_actionPerformed<span style="color: #009900;">&#40;</span><span style="color: #003399;">ActionEvent</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">int</span> n<span style="color: #339933;">=</span><span style="color: #003399;">Integer</span>.<span style="color: #006633;">parseInt</span><span style="color: #009900;">&#40;</span>jTextField1.<span style="color: #006633;">getText</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003399;">String</span> fila<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> x<span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> x <span style="color: #339933;">&lt;=</span> n<span style="color: #339933;">;</span> x<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>   <span style="color: #000066; font-weight: bold;">int</span> s<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
            <span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> x<span style="color: #339933;">*</span><span style="color: #cc66cc;">2</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#123;</span>
               <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>x <span style="color: #339933;">&lt;=</span> <span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
                <span style="color: #009900;">&#123;</span> 
                    s<span style="color: #339933;">--;</span>
                    <span style="color: #666666; font-style: italic;">// JOptionPane.showMessageDialog(this,&quot;x=&quot;+ String.valueOf(x) + &quot;   i=&quot;+ String.valueOf(i) + &quot;   s=&quot;+ String.valueOf(s*2)  );</span>
                     fila  <span style="color: #339933;">=</span> fila <span style="color: #339933;">+</span>  <span style="color: #003399;">String</span>.<span style="color: #006633;">valueOf</span><span style="color: #009900;">&#40;</span>x <span style="color: #339933;">+</span> i <span style="color: #339933;">+</span> s<span style="color: #339933;">*</span><span style="color: #cc66cc;">2</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; &quot;</span><span style="color: #339933;">;</span> 
                <span style="color: #009900;">&#125;</span>
                <span style="color: #000000; font-weight: bold;">else</span>
               <span style="color: #009900;">&#123;</span>
                    <span style="color: #666666; font-style: italic;">//JOptionPane.showMessageDialog(this,&quot;x=&quot;+ String.valueOf(x) + &quot;   i=&quot;+ String.valueOf(i) + &quot;   s=&quot;+ String.valueOf(s)  );</span>
                     fila  <span style="color: #339933;">=</span> fila <span style="color: #339933;">+</span>  <span style="color: #003399;">String</span>.<span style="color: #006633;">valueOf</span><span style="color: #009900;">&#40;</span>x <span style="color: #339933;">+</span> i <span style="color: #339933;">+</span> s <span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; &quot;</span><span style="color: #339933;">;</span> 
                <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span>
            list1.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>fila<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>   
            fila<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>   
    <span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://solocodigofuente.com/jdeveloper/fomar-un-triangulo-con-los-numeros-en-java-usando-jdeveloper/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ejercicios básicos de Java en JDeveloper parte II</title>
		<link>http://solocodigofuente.com/jdeveloper/ejercicios-basicos-de-java-en-jdeveloper-parte-ii/</link>
		<comments>http://solocodigofuente.com/jdeveloper/ejercicios-basicos-de-java-en-jdeveloper-parte-ii/#comments</comments>
		<pubDate>Tue, 12 Apr 2011 15:11:40 +0000</pubDate>
		<dc:creator>quihuinet</dc:creator>
				<category><![CDATA[JDeveloper]]></category>
		<category><![CDATA[addRow]]></category>
		<category><![CDATA[DefaultTableModel]]></category>
		<category><![CDATA[getRowCount]]></category>
		<category><![CDATA[JOptionPane]]></category>
		<category><![CDATA[showMessageDialog]]></category>
		<category><![CDATA[windowOpened]]></category>

		<guid isPermaLink="false">http://solocodigofuente.com/?p=518</guid>
		<description><![CDATA[Enumciado: Ingresar por teclado los nombres y apellidos de n personas y se guarden en una estructura de almacenamiento. el programa deberá solicitar el nombre para buscar en la estructura de datos y mostrar en pantalla.
Controles: jButton, jTextField y jLabel. 

Crear una clase en java llamada cBuscaPersona

public class cBuscaPersona &#123;
    public cBuscaPersona&#40;&#41; [...]]]></description>
			<content:encoded><![CDATA[<p>Enumciado: Ingresar por teclado los nombres y apellidos de n personas y se guarden en una estructura de almacenamiento. el programa deberá solicitar el nombre para buscar en la estructura de datos y mostrar en pantalla.</p>
<p>Controles: jButton, jTextField y jLabel. </p>
<p><a href="http://solocodigofuente.com/wp-content/uploads/2011/04/ejercicio_java.png"><img src="http://solocodigofuente.com/wp-content/uploads/2011/04/ejercicio_java.png" alt="" title="ejercicio_java" width="349" height="359" class="alignnone size-full wp-image-519" /></a></p>
<p>Crear una clase en java llamada cBuscaPersona</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> cBuscaPersona <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> cBuscaPersona<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> BuscarApellido<span style="color: #009900;">&#40;</span> <span style="color: #003399;">DefaultTableModel</span> jDatos , <span style="color: #003399;">String</span> buscar_nombre<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
        <span style="color: #003399;">String</span> nombre_encontrado<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #003399;">String</span> resultado<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>i <span style="color: #339933;">&lt;</span> jDatos.<span style="color: #006633;">getRowCount</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            nombre_encontrado<span style="color: #339933;">=</span>jDatos.<span style="color: #006633;">getValueAt</span><span style="color: #009900;">&#40;</span>i,<span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>nombre_encontrado.<span style="color: #006633;">equalsIgnoreCase</span><span style="color: #009900;">&#40;</span>buscar_nombre<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#123;</span>
                resultado<span style="color: #339933;">=</span>jDatos.<span style="color: #006633;">getValueAt</span><span style="color: #009900;">&#40;</span>i,<span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">return</span> resultado<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><span id="more-518"></span></p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">    <span style="color: #003399;">DefaultTableModel</span> jDatos <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">DefaultTableModel</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> jbGuardar_actionPerformed<span style="color: #009900;">&#40;</span><span style="color: #003399;">ActionEvent</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> dato<span style="color: #339933;">=</span><span style="color: #009900;">&#123;</span>jtfNombres.<span style="color: #006633;">getText</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>,jtfApellidos.<span style="color: #006633;">getText</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
        jDatos.<span style="color: #006633;">addRow</span><span style="color: #009900;">&#40;</span>dato<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        jtfNombres.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        jtfApellidos.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        jtfNombres.<span style="color: #006633;">requestFocus</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> this_windowOpened<span style="color: #009900;">&#40;</span><span style="color: #003399;">WindowEvent</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        jDatos.<span style="color: #006633;">addColumn</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;nombres&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        jDatos.<span style="color: #006633;">addColumn</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;apellidos&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> jbBuscar_actionPerformed<span style="color: #009900;">&#40;</span><span style="color: #003399;">ActionEvent</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        cBuscaPersona obj<span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> cBuscaPersona<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        jlApellidos.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Apellido buscado: &quot;</span> <span style="color: #339933;">+</span> obj.<span style="color: #006633;">BuscarApellido</span><span style="color: #009900;">&#40;</span>jDatos,jtfCriterio.<span style="color: #006633;">getText</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003399;">JOptionPane</span>.<span style="color: #006633;">showMessageDialog</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>,<span style="color: #0000ff;">&quot;Operación de búsqueda finalizada&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
    <span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://solocodigofuente.com/jdeveloper/ejercicios-basicos-de-java-en-jdeveloper-parte-ii/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ejercicios básicos de Java en JDeveloper parte I</title>
		<link>http://solocodigofuente.com/jdeveloper/ejercicios-basicos-de-java-en-jdeveloper-parte-i/</link>
		<comments>http://solocodigofuente.com/jdeveloper/ejercicios-basicos-de-java-en-jdeveloper-parte-i/#comments</comments>
		<pubDate>Sun, 10 Apr 2011 05:02:06 +0000</pubDate>
		<dc:creator>quihuinet</dc:creator>
				<category><![CDATA[JDeveloper]]></category>
		<category><![CDATA[clases]]></category>
		<category><![CDATA[DefaultListModel]]></category>
		<category><![CDATA[jButton]]></category>
		<category><![CDATA[jLabel]]></category>
		<category><![CDATA[jTextField]]></category>
		<category><![CDATA[requestFocus]]></category>
		<category><![CDATA[setModel]]></category>

		<guid isPermaLink="false">http://solocodigofuente.com/?p=505</guid>
		<description><![CDATA[Enunciado: Crea una aplicación en java que permita el ingreso de n números y mostrar los números pares, numeros múltiplos de 3 y 5. 
Controles: JList,jButton, jTextField y jLabel. 


    DefaultListModel lista= new  DefaultListModel&#40;&#41;;
    private void jbAgregar_actionPerformed&#40;ActionEvent e&#41; &#123;
      lista.addElement&#40;jtNumero.getText&#40;&#41;&#41;;  
  [...]]]></description>
			<content:encoded><![CDATA[<p>Enunciado: Crea una aplicación en java que permita el ingreso de n números y mostrar los números pares, numeros múltiplos de 3 y 5. </p>
<p>Controles: JList,jButton, jTextField y jLabel. </p>
<p><a href="http://solocodigofuente.com/wp-content/uploads/2011/04/javai.png"><img src="http://solocodigofuente.com/wp-content/uploads/2011/04/javai.png" alt="" title="javai" width="485" height="300" class="alignnone size-full wp-image-507" /></a></p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">    <span style="color: #003399;">DefaultListModel</span> lista<span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span>  <span style="color: #003399;">DefaultListModel</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> jbAgregar_actionPerformed<span style="color: #009900;">&#40;</span><span style="color: #003399;">ActionEvent</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      lista.<span style="color: #006633;">addElement</span><span style="color: #009900;">&#40;</span>jtNumero.<span style="color: #006633;">getText</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
    jList1.<span style="color: #006633;">setModel</span><span style="color: #009900;">&#40;</span>lista<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    jtNumero.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    jtNumero.<span style="color: #006633;">requestFocus</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> jbProcesar_actionPerformed<span style="color: #009900;">&#40;</span><span style="color: #003399;">ActionEvent</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        cEjercicioJava obj<span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> cEjercicioJava<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        obj.<span style="color: #006633;">Procesar</span><span style="color: #009900;">&#40;</span>lista<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        jlnumPar.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Total de números pares: &quot;</span> <span style="color: #339933;">+</span> <span style="color: #003399;">String</span>.<span style="color: #006633;">valueOf</span><span style="color: #009900;">&#40;</span>obj.<span style="color: #006633;">totalNumeroPar</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; Números:&quot;</span> <span style="color: #339933;">+</span> obj.<span style="color: #006633;">NumerosPares</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        jlMulti3.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Total de números Multiplos de 3: &quot;</span> <span style="color: #339933;">+</span> <span style="color: #003399;">String</span>.<span style="color: #006633;">valueOf</span><span style="color: #009900;">&#40;</span>obj.<span style="color: #006633;">totalMultiplo3</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; Números:&quot;</span> <span style="color: #339933;">+</span> obj.<span style="color: #006633;">NumerosMultiplo3</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        jlMulti5.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Total de números Multiplos de 5: &quot;</span> <span style="color: #339933;">+</span> <span style="color: #003399;">String</span>.<span style="color: #006633;">valueOf</span><span style="color: #009900;">&#40;</span>obj.<span style="color: #006633;">totalMultipo5</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; Números:&quot;</span> <span style="color: #339933;">+</span> obj.<span style="color: #006633;">NumerosMultiplo5</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Crear una clase en java llamada cEjercicioJava</p>
<p><span id="more-505"></span></p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.swing.DefaultListModel</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> cEjercicioJava <span style="color: #009900;">&#123;</span>
    cEjercicioJava<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">int</span> ctotalNumeroPar<span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">int</span> ctotalMultiplo3<span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">int</span> ctotalMultipo5<span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> cNumerosPares <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> cNumerosMultiplo3 <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> cNumerosMultiplo5 <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">int</span> num<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> Procesar<span style="color: #009900;">&#40;</span><span style="color: #003399;">DefaultListModel</span> lista<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">/*numeros pares*/</span>
        <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> lista.<span style="color: #006633;">size</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #339933;">++</span>i<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            num <span style="color: #339933;">=</span> <span style="color: #003399;">Integer</span>.<span style="color: #006633;">valueOf</span><span style="color: #009900;">&#40;</span>lista.<span style="color: #006633;">getElementAt</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>num <span style="color: #339933;">%</span> <span style="color: #cc66cc;">2</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                ctotalNumeroPar<span style="color: #339933;">++;</span>
                cNumerosPares <span style="color: #339933;">+=</span> <span style="color: #0000ff;">&quot;/&quot;</span> <span style="color: #339933;">+</span> <span style="color: #003399;">String</span>.<span style="color: #006633;">valueOf</span><span style="color: #009900;">&#40;</span>num<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
&nbsp;
            <span style="color: #666666; font-style: italic;">/*multiplos de 3*/</span>
            <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>num <span style="color: #339933;">%</span> <span style="color: #cc66cc;">3</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                ctotalMultiplo3<span style="color: #339933;">++;</span>
                cNumerosMultiplo3 <span style="color: #339933;">+=</span> <span style="color: #0000ff;">&quot;/&quot;</span> <span style="color: #339933;">+</span> <span style="color: #003399;">String</span>.<span style="color: #006633;">valueOf</span><span style="color: #009900;">&#40;</span>num<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
            <span style="color: #666666; font-style: italic;">/*multiplos de 5*/</span>
            <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>num <span style="color: #339933;">%</span> <span style="color: #cc66cc;">5</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                ctotalMultipo5<span style="color: #339933;">++;</span>
                cNumerosMultiplo5 <span style="color: #339933;">+=</span> <span style="color: #0000ff;">&quot;/&quot;</span> <span style="color: #339933;">+</span> <span style="color: #003399;">String</span>.<span style="color: #006633;">valueOf</span><span style="color: #009900;">&#40;</span>num<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">int</span> totalNumeroPar<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">return</span> ctotalNumeroPar<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #003399;">String</span> NumerosPares<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">return</span> cNumerosPares<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">int</span> totalMultiplo3<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">return</span> ctotalMultiplo3<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #003399;">String</span> NumerosMultiplo3<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">return</span> cNumerosMultiplo3<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">int</span> totalMultipo5<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">return</span> ctotalMultipo5<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #003399;">String</span> NumerosMultiplo5<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">return</span> cNumerosMultiplo5<span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://solocodigofuente.com/jdeveloper/ejercicios-basicos-de-java-en-jdeveloper-parte-i/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mostrar Numeros pares e impares en el control jList usando DefaultListModel en Java</title>
		<link>http://solocodigofuente.com/jdeveloper/mostrar-numeros-pares-e-impares-en-el-control-jlist-usando-defaultlistmodel-en-java/</link>
		<comments>http://solocodigofuente.com/jdeveloper/mostrar-numeros-pares-e-impares-en-el-control-jlist-usando-defaultlistmodel-en-java/#comments</comments>
		<pubDate>Tue, 29 Mar 2011 21:02:07 +0000</pubDate>
		<dc:creator>quihuinet</dc:creator>
				<category><![CDATA[JDeveloper]]></category>
		<category><![CDATA[DefaultListModel]]></category>
		<category><![CDATA[jButton]]></category>
		<category><![CDATA[jLabel]]></category>
		<category><![CDATA[jList]]></category>

		<guid isPermaLink="false">http://solocodigofuente.com/?p=500</guid>
		<description><![CDATA[Controles utilizados: jTextField, jButton, jList, jLabel



    DefaultListModel ListaNumero = new DefaultListModel&#40;&#41;;
&#160;
    private void jbAgregar_actionPerformed&#40;ActionEvent e&#41; &#123;
        ListaNumero.addElement&#40;jtfNumero.getText&#40;&#41;&#41;;
        jlNumeros.setModel&#40;ListaNumero&#41;;
        jtfNumero.setText&#40;&#34;&#34;&#41;;
        jtfNumero.requestFocus&#40;&#41;;
  [...]]]></description>
			<content:encoded><![CDATA[<p>Controles utilizados: jTextField, jButton, jList, jLabel<br />
<a href="http://solocodigofuente.com/wp-content/uploads/2011/03/numero-para-e-impar.png"><img src="http://solocodigofuente.com/wp-content/uploads/2011/03/numero-para-e-impar.png" alt="numero par e impar usando DefaultListModel" title="numero para e impar" width="250" height="282" class="alignnone size-full wp-image-502" /></a><br />
<span id="more-500"></span></p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">    <span style="color: #003399;">DefaultListModel</span> ListaNumero <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">DefaultListModel</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> jbAgregar_actionPerformed<span style="color: #009900;">&#40;</span><span style="color: #003399;">ActionEvent</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        ListaNumero.<span style="color: #006633;">addElement</span><span style="color: #009900;">&#40;</span>jtfNumero.<span style="color: #006633;">getText</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        jlNumeros.<span style="color: #006633;">setModel</span><span style="color: #009900;">&#40;</span>ListaNumero<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        jtfNumero.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        jtfNumero.<span style="color: #006633;">requestFocus</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #003399;">DefaultListModel</span> listaTemp <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">DefaultListModel</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> jbPar_actionPerformed<span style="color: #009900;">&#40;</span><span style="color: #003399;">ActionEvent</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        listaTemp.<span style="color: #006633;">clear</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> ListaNumero.<span style="color: #006633;">getSize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #003399;">String</span> num <span style="color: #339933;">=</span> ListaNumero.<span style="color: #006633;">elementAt</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Integer</span>.<span style="color: #006633;">valueOf</span><span style="color: #009900;">&#40;</span>num<span style="color: #009900;">&#41;</span> <span style="color: #339933;">%</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                listaTemp.<span style="color: #006633;">addElement</span><span style="color: #009900;">&#40;</span>ListaNumero.<span style="color: #006633;">getElementAt</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
        jlResultado.<span style="color: #006633;">setModel</span><span style="color: #009900;">&#40;</span>listaTemp<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> jbImpar_actionPerformed<span style="color: #009900;">&#40;</span><span style="color: #003399;">ActionEvent</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        listaTemp.<span style="color: #006633;">clear</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> ListaNumero.<span style="color: #006633;">getSize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #003399;">String</span> num <span style="color: #339933;">=</span> ListaNumero.<span style="color: #006633;">elementAt</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Integer</span>.<span style="color: #006633;">valueOf</span><span style="color: #009900;">&#40;</span>num<span style="color: #009900;">&#41;</span> <span style="color: #339933;">%</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                listaTemp.<span style="color: #006633;">addElement</span><span style="color: #009900;">&#40;</span>ListaNumero.<span style="color: #006633;">getElementAt</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
        jlResultado.<span style="color: #006633;">setModel</span><span style="color: #009900;">&#40;</span>listaTemp<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> jbQuitar_actionPerformed<span style="color: #009900;">&#40;</span><span style="color: #003399;">ActionEvent</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        ListaNumero.<span style="color: #006633;">removeElementAt</span><span style="color: #009900;">&#40;</span>jlNumeros.<span style="color: #006633;">getSelectedIndex</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://solocodigofuente.com/jdeveloper/mostrar-numeros-pares-e-impares-en-el-control-jlist-usando-defaultlistmodel-en-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enlazar una lista a un ComboBox y DatagridView en Visual Basic .Net</title>
		<link>http://solocodigofuente.com/ejemplos-de-codigo-fuente-en-visual-basic-net/enlazar-una-lista-a-un-combobox-y-datagridview-en-visual-basic-net/</link>
		<comments>http://solocodigofuente.com/ejemplos-de-codigo-fuente-en-visual-basic-net/enlazar-una-lista-a-un-combobox-y-datagridview-en-visual-basic-net/#comments</comments>
		<pubDate>Sun, 27 Mar 2011 14:56:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Visual Basic .NET]]></category>
		<category><![CDATA[combobox]]></category>
		<category><![CDATA[datagridview]]></category>
		<category><![CDATA[datasource]]></category>
		<category><![CDATA[entidad]]></category>
		<category><![CDATA[listas]]></category>
		<category><![CDATA[listof]]></category>

		<guid isPermaLink="false">http://solocodigofuente.com/?p=491</guid>
		<description><![CDATA[
Para este ejemplo primero crearemos la clase Categoria.

Public Class Categoria
    Private cCodigo As Short
    Private cDescripcion As String
&#160;
    Public Property Codigo() As Short
        Get
            Return cCodigo
   [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://solocodigofuente.com/wp-content/uploads/2011/03/utilizando-listas.png"><img class="alignnone size-full wp-image-492" title="utilizando listas para enlazar a un datagridview" src="http://solocodigofuente.com/wp-content/uploads/2011/03/utilizando-listas.png" alt="" width="358" height="498" /></a>
<p>Para este ejemplo primero crearemos la clase Categoria.</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Public</span> Class Categoria
    <span style="color: #000080;">Private</span> cCodigo <span style="color: #000080;">As</span> Short
    <span style="color: #000080;">Private</span> cDescripcion <span style="color: #000080;">As</span> <span style="color: #000080;">String</span>
&nbsp;
    <span style="color: #000080;">Public</span> <span style="color: #000080;">Property</span> Codigo() <span style="color: #000080;">As</span> Short
        <span style="color: #000080;">Get</span>
            Return cCodigo
        <span style="color: #000080;">End</span> <span style="color: #000080;">Get</span>
        <span style="color: #000080;">Set</span>(<span style="color: #000080;">ByVal</span> value <span style="color: #000080;">As</span> Short)
            cCodigo = value
        <span style="color: #000080;">End</span> <span style="color: #000080;">Set</span>
    <span style="color: #000080;">End</span> <span style="color: #000080;">Property</span>
&nbsp;
    <span style="color: #000080;">Public</span> <span style="color: #000080;">Property</span> Descripcion() <span style="color: #000080;">As</span> <span style="color: #000080;">String</span>
        <span style="color: #000080;">Get</span>
            Return cDescripcion
        <span style="color: #000080;">End</span> <span style="color: #000080;">Get</span>
        <span style="color: #000080;">Set</span>(<span style="color: #000080;">ByVal</span> value <span style="color: #000080;">As</span> <span style="color: #000080;">String</span>)
            cDescripcion = value
        <span style="color: #000080;">End</span> <span style="color: #000080;">Set</span>
    <span style="color: #000080;">End</span> <span style="color: #000080;">Property</span>
<span style="color: #000080;">End</span> Class</pre></div></div>

<p><span id="more-491"></span></p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Public</span> Class Form1
    <span style="color: #000080;">Dim</span> lCategoria <span style="color: #000080;">As</span> <span style="color: #000080;">New</span> List(Of Categoria)
    <span style="color: #000080;">Private</span> <span style="color: #000080;">Sub</span> bAgregar_Lista_Click(<span style="color: #000080;">ByVal</span> sender <span style="color: #000080;">As</span> System.<span style="color: #000080;">Object</span>, <span style="color: #000080;">ByVal</span> e <span style="color: #000080;">As</span> System.EventArgs) Handles bAgregar_Lista.Click
        <span style="color: #000080;">Dim</span> iCategoria <span style="color: #000080;">As</span> <span style="color: #000080;">New</span> Categoria
        iCategoria.Codigo = TextBox1.Text
        iCategoria.Descripcion = TextBox2.Text
        lCategoria.Add(iCategoria)
        Label3.Text = <span style="color: #800000;">&quot;Total de item: &quot;</span> &amp; lCategoria.Count
    <span style="color: #000080;">End</span> <span style="color: #000080;">Sub</span>
&nbsp;
    <span style="color: #000080;">Private</span> <span style="color: #000080;">Sub</span> bCargar_Combobox_Click(<span style="color: #000080;">ByVal</span> sender <span style="color: #000080;">As</span> System.<span style="color: #000080;">Object</span>, <span style="color: #000080;">ByVal</span> e <span style="color: #000080;">As</span> System.EventArgs) Handles bCargar_Combobox.Click
        cobCategoria.DataSource = <span style="color: #000080;">Nothing</span>
        cobCategoria.DataSource = lCategoria
        cobCategoria.DisplayMember = <span style="color: #800000;">&quot;Descripcion&quot;</span>
        cobCategoria.ValueMember = <span style="color: #800000;">&quot;Codigo&quot;</span>
    <span style="color: #000080;">End</span> <span style="color: #000080;">Sub</span>
&nbsp;
    <span style="color: #000080;">Private</span> <span style="color: #000080;">Sub</span> cobCategoria_SelectedIndexChanged(<span style="color: #000080;">ByVal</span> sender <span style="color: #000080;">As</span> System.<span style="color: #000080;">Object</span>, <span style="color: #000080;">ByVal</span> e <span style="color: #000080;">As</span> System.EventArgs) Handles cobCategoria.SelectedIndexChanged
        Try
            TextBox3.Text = cobCategoria.SelectedValue
        Catch ex <span style="color: #000080;">As</span> Exception
        <span style="color: #000080;">End</span> Try
    <span style="color: #000080;">End</span> <span style="color: #000080;">Sub</span>
&nbsp;
    <span style="color: #000080;">Private</span> <span style="color: #000080;">Sub</span> bCargar_Gridview_Click(<span style="color: #000080;">ByVal</span> sender <span style="color: #000080;">As</span> System.<span style="color: #000080;">Object</span>, <span style="color: #000080;">ByVal</span> e <span style="color: #000080;">As</span> System.EventArgs) Handles bCargar_Gridview.Click
        DataGridView1.DataSource = <span style="color: #000080;">Nothing</span>
        DataGridView1.DataSource = lCategoria
    <span style="color: #000080;">End</span> <span style="color: #000080;">Sub</span>
<span style="color: #000080;">End</span> Class</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://solocodigofuente.com/ejemplos-de-codigo-fuente-en-visual-basic-net/enlazar-una-lista-a-un-combobox-y-datagridview-en-visual-basic-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Marquesina en el titulo del Windows Forms en Visual Basic .Net</title>
		<link>http://solocodigofuente.com/ejemplos-de-codigo-fuente-en-visual-basic-net/marquesina-en-el-titulo-del-windows-forms-en-visual-basic-net/</link>
		<comments>http://solocodigofuente.com/ejemplos-de-codigo-fuente-en-visual-basic-net/marquesina-en-el-titulo-del-windows-forms-en-visual-basic-net/#comments</comments>
		<pubDate>Thu, 10 Mar 2011 05:44:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Visual Basic .NET]]></category>
		<category><![CDATA[basic]]></category>
		<category><![CDATA[cshort]]></category>
		<category><![CDATA[marquesina]]></category>
		<category><![CDATA[timer]]></category>
		<category><![CDATA[visual]]></category>
		<category><![CDATA[windowsforms]]></category>

		<guid isPermaLink="false">http://solocodigofuente.com/?p=483</guid>
		<description><![CDATA[
Public Class Form1
    Dim texto As String
    Dim ancho As Short
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        texto += &#34; &#34;
        Text = texto + TextBox1.Text
 [...]]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Public</span> Class Form1
    <span style="color: #000080;">Dim</span> texto <span style="color: #000080;">As</span> <span style="color: #000080;">String</span>
    <span style="color: #000080;">Dim</span> ancho <span style="color: #000080;">As</span> Short
    <span style="color: #000080;">Private</span> <span style="color: #000080;">Sub</span> Timer1_Tick(<span style="color: #000080;">ByVal</span> sender <span style="color: #000080;">As</span> System.<span style="color: #000080;">Object</span>, <span style="color: #000080;">ByVal</span> e <span style="color: #000080;">As</span> System.EventArgs) Handles Timer1.Tick
        texto += <span style="color: #800000;">&quot; &quot;</span>
        Text = texto + TextBox1.Text
        ancho += 1
        <span style="color: #000080;">If</span> CShort(((Width / 4) + 1)) = ancho <span style="color: #000080;">Then</span>
            texto = <span style="color: #000080;">String</span>.Empty
            Text = <span style="color: #000080;">String</span>.Empty
            ancho = 0
        <span style="color: #000080;">End</span> <span style="color: #000080;">If</span>
    <span style="color: #000080;">End</span> <span style="color: #000080;">Sub</span>
<span style="color: #000080;">End</span> Class</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://solocodigofuente.com/ejemplos-de-codigo-fuente-en-visual-basic-net/marquesina-en-el-titulo-del-windows-forms-en-visual-basic-net/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Crear la capa Presentacion en Visual Basic .Net / Parte VI</title>
		<link>http://solocodigofuente.com/ejemplos-de-codigo-fuente-en-visual-basic-net/crear-la-capa-presentacion-en-visual-basic-net-parte-vi/</link>
		<comments>http://solocodigofuente.com/ejemplos-de-codigo-fuente-en-visual-basic-net/crear-la-capa-presentacion-en-visual-basic-net-parte-vi/#comments</comments>
		<pubDate>Mon, 20 Dec 2010 20:00:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Visual Basic .NET]]></category>
		<category><![CDATA[capa]]></category>
		<category><![CDATA[console]]></category>
		<category><![CDATA[presentacion]]></category>

		<guid isPermaLink="false">http://solocodigofuente.com/?p=458</guid>
		<description><![CDATA[Modo Consola:

'Hacer la referencia a la capa negocios (CapaNegocios.dll)
Imports CapaNegocios
Module Module1
    Sub Main()
        Dim can As New Empleado_Neg
        Console.WriteLine(&#34;Total de empleados: &#34; &#38;amp; can.Total_de_Empleados)
        Console.ReadLine()
    End Sub
End Module

Modo [...]]]></description>
			<content:encoded><![CDATA[<p>Modo Consola:</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #008000;">'Hacer la referencia a la capa negocios (CapaNegocios.dll)
</span>Imports CapaNegocios
Module Module1
    <span style="color: #000080;">Sub</span> Main()
        <span style="color: #000080;">Dim</span> can <span style="color: #000080;">As</span> <span style="color: #000080;">New</span> Empleado_Neg
        Console.WriteLine(<span style="color: #800000;">&quot;Total de empleados: &quot;</span> &amp;amp; can.Total_de_Empleados)
        Console.ReadLine()
    <span style="color: #000080;">End</span> <span style="color: #000080;">Sub</span>
<span style="color: #000080;">End</span> Module</pre></div></div>

<p>Modo WindowForm:<br />
<span id="more-458"></span><br />
<a href="http://solocodigofuente.com/wp-content/uploads/2010/12/winform.png"><img class="alignnone size-full wp-image-461" title="windows forms" src="http://solocodigofuente.com/wp-content/uploads/2010/12/winform.png" alt="&quot;Capa presentación&quot;" width="380" height="211" /></a></p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;">Imports CapaNegocios
<span style="color: #000080;">Public</span> Class frmEmpleado
    <span style="color: #000080;">Private</span> <span style="color: #000080;">Sub</span> bAceptar_Click(<span style="color: #000080;">ByVal</span> sender <span style="color: #000080;">As</span> System.<span style="color: #000080;">Object</span>, <span style="color: #000080;">ByVal</span> e <span style="color: #000080;">As</span> System.EventArgs) Handles bAceptar.Click
        <span style="color: #000080;">Dim</span> cont <span style="color: #000080;">As</span> <span style="color: #000080;">New</span> Empleado_Neg
        TextBox1.Text = cont.Total_de_Empleados
    <span style="color: #000080;">End</span> <span style="color: #000080;">Sub</span>
<span style="color: #000080;">End</span> Class</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://solocodigofuente.com/ejemplos-de-codigo-fuente-en-visual-basic-net/crear-la-capa-presentacion-en-visual-basic-net-parte-vi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Crear la capa Negocio en Visual Basic .Net / Parte III</title>
		<link>http://solocodigofuente.com/ejemplos-de-codigo-fuente-en-visual-basic-net/crear-la-capa-negocio-en-visual-basic-net-parte-iii/</link>
		<comments>http://solocodigofuente.com/ejemplos-de-codigo-fuente-en-visual-basic-net/crear-la-capa-negocio-en-visual-basic-net-parte-iii/#comments</comments>
		<pubDate>Sun, 19 Dec 2010 19:50:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Visual Basic .NET]]></category>
		<category><![CDATA[capa]]></category>
		<category><![CDATA[ExecuteScalar]]></category>
		<category><![CDATA[imports]]></category>
		<category><![CDATA[negocio]]></category>
		<category><![CDATA[sqlclient]]></category>
		<category><![CDATA[Try]]></category>

		<guid isPermaLink="false">http://solocodigofuente.com/?p=455</guid>
		<description><![CDATA[Hacemos referencia a las librerías:
CapaDatos.dll
CapaEntidad.dll
Luego importamos las siguientes NameSpace.

Imports CapaAccesoDatos
Imports CapaEntidad
Imports System.Data.SqlClient



Public Class Empleado_Neg
    Dim cn As AccesoDatos
    Public Function Total_de_Empleados() As Integer
        Dim cTotalEmp As Integer
        cn = New AccesoDatos
     [...]]]></description>
			<content:encoded><![CDATA[<p>Hacemos referencia a las librerías:<br />
CapaDatos.dll<br />
CapaEntidad.dll<br />
Luego importamos las siguientes NameSpace.</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;">Imports CapaAccesoDatos
Imports CapaEntidad
Imports System.Data.SqlClient</pre></div></div>

<p><span id="more-455"></span></p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Public</span> Class Empleado_Neg
    <span style="color: #000080;">Dim</span> cn <span style="color: #000080;">As</span> AccesoDatos
    <span style="color: #000080;">Public</span> <span style="color: #000080;">Function</span> Total_de_Empleados() <span style="color: #000080;">As</span> <span style="color: #000080;">Integer</span>
        <span style="color: #000080;">Dim</span> cTotalEmp <span style="color: #000080;">As</span> <span style="color: #000080;">Integer</span>
        cn = <span style="color: #000080;">New</span> AccesoDatos
        <span style="color: #000080;">Dim</span> cmdTotalEmp <span style="color: #000080;">As</span> <span style="color: #000080;">New</span> SqlCommand
        cmdTotalEmp.Connection = cn.Conexion
        cmdTotalEmp.CommandType = CommandType.Text
        cmdTotalEmp.CommandText = <span style="color: #800000;">&quot;Select count(IdEmpleado) from Empleado&quot;</span>
        cmdTotalEmp.Connection.<span style="color: #000080;">Open</span>()
        Try
            cTotalEmp = cmdTotalEmp.ExecuteScalar
            Return cTotalEmp
        Catch ex <span style="color: #000080;">As</span> Exception
            Throw
        Finally
            cn.Conexion.<span style="color: #000080;">Close</span>()
        <span style="color: #000080;">End</span> Try
    <span style="color: #000080;">End</span> <span style="color: #000080;">Function</span>
<span style="color: #000080;">End</span> Class</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://solocodigofuente.com/ejemplos-de-codigo-fuente-en-visual-basic-net/crear-la-capa-negocio-en-visual-basic-net-parte-iii/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- www.000webhost.com Analytics Code -->
<script type="text/javascript" src="http://stats.hosting24.com/count.php"></script>
<noscript><a href="http://www.hosting24.com/"><img src="http://stats.hosting24.com/count.php" alt="web hosting" /></a></noscript>
<!-- End Of Analytics Code -->

