antiblock
diamwall
  • Chatbox

    You don't have permission to chat.
    Load More
Sign in to follow this  
jokass

[Ajuda] Vb Tabelas Copiar

3 posts in this topic

Capturar.png

Boas pessoal tenho uma tabela em vb a qual vai ser sempre a mesma para o que quero fazer , deixa me explicar melhor 

 

consoante a informação que me dão num ficheiro de quantos report vou ter (ini,txt,xml) tenho de criar uma nova tabela (copiar a primeira e por  uns pixels mais a baixo  ) para cada report
podem me ajudar com o codigo, sou novato em vb certas funcionalidades e codigo passa me completamente a lado , obrigado pela disponibilidade de quem ajudar 

Share this post


Link to post
Share on other sites
antiblock
diamwall

Isso é .net ou vb < .net?

 

Já agora, és obrigado a fazer isso em VB?

 

De qualquer maneira, como é que é a estrutura desse ficheiro que contem a data, é decidido por ti ou...?

Share this post


Link to post
Share on other sites

o projeto que estou a elaborar é em vb ,

os dados são todos fornecidos por um ficheiro  (ini ,txt ou xml) , ao qual vou busca lo criando um variável -  Dim dt As String = "c:\user\novapasta\settings.ini"  depois tenho uma função para ler o ficheiro 

lerINI(dt, "general", "index_color"))

onde general é o nome da section e o index_color a entry isto retorna me o value depois de "index_color="


(um pequeno a parte o cyber-gamers nao tem spooler? )

'Module INI
    <DllImport("kernel32.dll", SetLastError:=True)> Public Function WritePrivateProfileString _
      (ByVal lpApplicationName As String, _
      ByVal lpKeyName As String, ByVal lpString As String, ByVal lpFileName As String) As Integer
    End Function

    Public Function GetPrivateProfileStrin(ByVal lpAppName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As StringBuilder, ByVal nSize As Integer, ByVal lpFileName As String) As Integer
    End Function

    Public Function lerINI(ByVal novo_valor As String, ByVal diretorio_arquivo As String, ByVal secao As String) As String
        Dim entrada As StringBuilder = New StringBuilder(255)
        Dim intSize As Integer
        intSize = GetPrivateProfileString(diretorio_arquivo, secao, "", entrada, 255, novo_valor)
        Return entrada.ToString
    End Function
    Public Function lerINIEntrada(ByVal novo_valor As String, ByVal diretorio_arquivo As String, ByVal secao As String) As String
        Dim entrada_valor As StringBuilder = New StringBuilder(255)
        Dim intSize2 As Integer
        intSize2 = GetPrivateProfileString(diretorio_arquivo, secao, "", entrada_valor, 255, novo_valor)
        Return novo_valor.ToString
    End Function





    <DllImport("kernel32")> _
    Private Function GetPrivateProfileString(Section As String, Key As String, Value As String, Result As StringBuilder, Size As Integer, FileName As String) As Integer
    End Function


    <DllImport("kernel32")> _
    Private Function GetPrivateProfileString(Section As String, Key As Integer, Value As String, <MarshalAs(UnmanagedType.LPArray)> Result As Byte(), Size As Integer, FileName As String) As Integer
    End Function

    <DllImport("kernel32")> _
    Private Function GetPrivateProfileString(Section As Integer, Key As String, Value As String, <MarshalAs(UnmanagedType.LPArray)> Result As Byte(), Size As Integer, FileName As String) As Integer
    End Function

    Public Sub ola(INIPath As String)
        Dim path As String = INIPath
    End Sub
    Public path As String

    Public Function GetSectionNames() As String()
        Dim maxsize As Integer = 500
        While True
            Dim bytes As Byte() = New Byte(maxsize - 1) {}
            Dim size As Integer = GetPrivateProfileString(0, "", "", bytes, maxsize, path)
            If size < maxsize - 2 Then
                Dim Selected As String = Encoding.ASCII.GetString(bytes, 0, size - (If(size > 0, 1, 0)))
                Return Selected.Split(New Char() {ControlChars.NullChar})
            End If
            maxsize *= 2
        End While
    End Function
    Public Function GetEntryNames(section As String) As String()
        Dim maxsize As Integer = 500
        While True
            Dim bytes As Byte() = New Byte(maxsize - 1) {}
            Dim size As Integer = GetPrivateProfileString(section, 0, "", bytes, maxsize, path)
            If size < maxsize - 2 Then
                Dim entries As String = Encoding.ASCII.GetString(bytes, 0, size - (If(size > 0, 1, 0)))
                Return entries.Split(New Char() {ControlChars.NullChar})
            End If
            maxsize *= 2
        End While
    End Function
    Public Function GetEntryValue(section As String, entry As String) As Object
        Dim maxsize As Integer = 250
        While True
            Dim result As New StringBuilder(maxsize)
            Dim size As Integer = GetPrivateProfileString(section, entry, "", result, maxsize, path)
            If size < maxsize - 1 Then
                Return result.ToString()
            End If
            maxsize *= 2
        End While


    End Function
End Module

a minha grande duvida é como é que eu sabendo que no ficheiro vai dizer que tem relatório 1 2 3 4 5 6 tenho de dar copy da tabela 1 e reproduzir as demais

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this