Foros del Web » Programación para mayores de 30 ;) » .NET »

Cambio formato y leer nombre archivo

Estas en el tema de Cambio formato y leer nombre archivo en el foro de .NET en Foros del Web. Hola: Puedo cargar un archivo binario, lo lee y muestra datos en los textbox. Su código del Form1. @import url("http://static.forosdelweb.com/clientscript/vbulletin_css/geshi.css"); Código C++: Ver original using ...
  #1 (permalink)  
Antiguo 10/06/2015, 15:27
 
Fecha de Ingreso: mayo-2007
Ubicación: PIC-16F84A
Mensajes: 727
Antigüedad: 17 años
Puntos: 8
Cambio formato y leer nombre archivo

Hola:

Puedo cargar un archivo binario, lo lee y muestra datos en los textbox.


Su código del Form1.
Código C++:
Ver original
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. using System.IO; // No olvidar.
  12.  
  13. namespace ROM_SNES
  14. {
  15.     public partial class Form1 : Form
  16.     {
  17.         public Form1()
  18.         {
  19.             InitializeComponent();
  20.         }
  21.  
  22.         private void button1_Click(object sender, EventArgs e)
  23.         {
  24.  
  25.             if (openFileDialog1.ShowDialog() == DialogResult.OK)
  26.             {
  27.                 FileInfo Archivo = new FileInfo(openFileDialog1.FileName);
  28.                 SnesKit.RomDump VARIABLE = new SnesKit.RomDump(File.ReadAllBytes(openFileDialog1.FileName.ToString()));
  29.                 textBox_Nombre_ruta_archivo.Text = openFileDialog1.FileName.ToString(); // Muestra la ruta del archivo.
  30.                 textBox_Name.Text = VARIABLE.Name;
  31.                 textBox_Layout.Text = string.Format("{0:X}", VARIABLE.Layout);
  32.                 textBox_CartridgeType.Text = string.Format("{0:X}", VARIABLE.CartridgeType);
  33.                 textBox_RomSize.Text = string.Format("{0:X}", VARIABLE.RomSize);
  34.                 textBox_RamSize.Text = string.Format("{0:X}", VARIABLE.RamSize);
  35.                 textBox_CountryCode.Text = string.Format("{0:X}", VARIABLE.CountryCode);
  36.                 textBox_LicenseCode.Text = string.Format("{0:X}", VARIABLE.LicenseCode);
  37.                 textBox_VersionNumber.Text = string.Format("{0:X}", VARIABLE.VersionNumber);
  38.                 textBox_BankType.Text = VARIABLE.BankType.ToString();
  39.                 textBox_Checksum.Text = string.Format("{0:X}", VARIABLE.Checksum);
  40.                 textBox_ChecksumCompliment.Text = string.Format("{0:X}", VARIABLE.ChecksumCompliment);
  41.                 textBox_SmcHeader.Text = VARIABLE.SmcHeader ? "True" : "False";
  42.                 textBox_HeaderLocation.Text = string.Format("{0:X}", VARIABLE.HeaderLocation);
  43.                 textBox_MB.Text = string.Format("{0:N0}", (Archivo.Length / 1024f) / 1024f); // Resultado 4 MB.
  44.                 textBox_KB.Text = string.Format("{0:N0}", (Archivo.Length / 1024f)); // 4.907 KB.
  45.                 textBox_Bytes.Text = string.Format("{0:N0}", Archivo.Length); // 4.194.816 B o Bytes.
  46.                 textBox_Mbit.Text = string.Format("{0:N0}", ((Archivo.Length / 1024f) / 1024f) * 8); // Mega bits.
  47.             }
  48.         }
  49.     }
  50. }
1) En el cuadro 3 azul, en el textBox que pone M, tiene el número introducido un 4. Quiero que se vea en vez de 4 pelado, que sea así: 4.00 por poner un ejemplo.

A pesar de hechar un ojo por aquí, no lo logro.


2) En el Cuadro 4 amarillo, donde pone "Nombre del archivo" no me sale. He estado leyendo por aquí y no me entero aunque lo tenga delante.

¿Cómo se hace?

Un cordial saludo.
__________________
Meta Shell, VERSIÓN 1.2.2
Descargar

Etiquetas: formato, nombre, windows
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 04:03.