Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
D

DeDelva

@DeDelva
About
Posts
17
Topics
6
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Playing with services
    D DeDelva

    Hey i'm back from a student holiday Thx for all the answers i will vote 4 them... I posted the wrong code snippet here is the code that i wanted to post :

    Imports Microsoft.Office.Interop
    Try

                Dim oApp As New Excel.Application()
                Dim oBook As Excel.Workbook = oApp.Workbooks.Add
                Dim oSheet As Excel.Worksheet = oApp.ActiveSheet
    
                chartRange = oSheet.range("A20", "G20")
                oSheet.Range("A20").Value = "blabla"
                chartRange.BorderAround(Excel.XlLineStyle.xlContinuous, \_
                Excel.XlBorderWeight.xlMedium, Excel.XlColorIndex. \_
          xlColorIndexAutomatic, Excel.XlColorIndex.xlColorIndexAutomatic)
    
                'Save the Workbook and quit Excel.
                oBook.SaveAs(sSampleFolder & "V.F." & idvoorexcel & "-" & Label6.Text & "-" & DateTime.Now.ToString("ddMMyyHHmmss") & ".xlsx")
                oSheet = Nothing
                NAR(oSheet)
                oBook.Close(False)
                NAR(oBook)
                oBook = Nothing
                oApp.Quit()
                NAR(oApp)
                oApp = Nothing
                System.Threading.Thread.Sleep(1500)
            End If
        Catch ex As Exception
            NAR(oSheet)
            oBook.Close(False)
            NAR(oBook)
            oSheet = Nothing
            oBook.Close(False)
            oBook = Nothing
            System.Threading.Thread.Sleep(1500)
            GC.Collect()
        End Try
    Private Sub NAR(ByVal o As Object)
        Try
            System.Runtime.InteropServices.Marshal.ReleaseComObject(o)
        Catch
        Finally
            o = Nothing
        End Try
    End Sub
    

    By the way nice link with the NAR Still don't know if i oversaw something? Thx D:thumbsup:

    Visual Basic csharp help question

  • Playing with services
    D DeDelva

    Hey, Thx Dave it was a really helpfull article. Can you check if i forget something?(maybe in my catch blok or something?)

                Dim oApp As New Excel.Application()
                Dim oBook As Excel.Workbook = oApp.Workbooks.Add
                Dim oSheet As Excel.Worksheet = oApp.ActiveSheet
                Dim chartRange As Excel.Range
    
                'hoofding
                chartRange = oSheet.Range("A1", "I1")
                chartRange.Merge()
                chartRange.FormulaR1C1 = "WorkBook"
                chartRange.Font.Bold = True
                chartRange.Font.Size = 20
                chartRange.HorizontalAlignment = 3
                'chartRange.VerticalAlignment = 3
    
                'Save the Workbook
                oBook.SaveAs(sSampleFolder & "V.F." & idvoorexcel & "-" & Label6.Text & ".xlsx")
    
                oSheet = Nothing
                oBook.Close(False)
                oBook = Nothing
                oApp.Quit()
                oApp = Nothing
                System.Threading.Thread.Sleep(3000)
    
            End If
        Catch ex As Exception
            MsgBox("location : catch blok")
            oSheet = Nothing
            oBook = Nothing
        End Try
    

    Greetings

    Visual Basic csharp help question

  • Playing with services
    D DeDelva

    Hello All, I'm playing with interactions between excel and vb.net... Everytime i start an excel application it become's one of my processes in my taskbar. I always put my vars from workbook,sheets,app to nothing at the end i collect my garbage But wath do i forget to dispose this from the services?? I'm kind a noob so can somebody provide me some help? I just want to clean up after using...

    oSheet = Nothing
    oBook = Nothing
    oExcel.Quit()
    oExcel = Nothing
    GC.Collect()

    Thx in advance

    Visual Basic csharp help question

  • How to pass values between 2 mdi childs?(without new form)
    D DeDelva

    hmm Dave i'm not that good that i can apply your last comment into my project... I searched whole day like crazy: Your example:

    Public Class FormMain

    Private WithEvents selectKlant As FormCustomerLookup = Nothing

    Private Sub ButtonLookup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonLookup.Click
    selectKlant = New FormCustomerLookup
    selectKlant.Show()

    End Sub
    

    Private Sub selectForm_CustomerSelected(ByVal item As String) Handles selectKlant.CustomerSelected
    TextSelectedCustomer.Text = item
    selectKlant.Close()
    End Sub
    End Class

    Public Class FormCustomerLookup
    Public Event CustomerSelected(ByVal item As String)

    Private Sub ButtonSelect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSelect.Click
    If DataGridView1.SelectedRows.Count = 0 Then
    RaiseEvent CustomerSelected(DataGridView1.Item(2, 1).Value.ToString())
    End If
    End Sub
    End Class

    I just want to change your givin example. So actually i start on formcustomerlookup and before i raise my event i want to open "formmain" and fill the textbox with the value. do i have to switch the with event or??because i cannot move the

    selectKlant = New FormCustomerLookup
    selectKlant.Show()

    Greetz Dave and hoping 4 some patience again...

    Visual Basic question css algorithms help tutorial

  • How to pass values between 2 mdi childs?(without new form)
    D DeDelva

    Dave, Can you tell me what changes if i want to send my values to destination form?(using events)? Before it was form 1 opens form2 you select a value and send back to form1 close form2 now i want form1 opens form2 and sends the values immediantly. Can you provide my info about the change in code? Thx in advance agian greetz

    Visual Basic question css algorithms help tutorial

  • Why a sub is not loaded in form load but in a button it is?
    D DeDelva

    Private Sub factuurZoeken_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Try
    m_SelectedStyle = New DataGridViewCellStyle()
    m_SelectedStyle.BackColor = Color.LightBlue
    m_SelectedStyle.BackColor = SystemColors.Highlight
    DataGridView1.ReadOnly = True
    Dim SQLString As String = "SELECT id, bedrijfsnaam, startdatum, vervaldatum, omschrijving, netto, bruto, opmerkingen FROM Facturen"
    Dim DataSet As New DataSet()
    Dim OleDbDataAdapter As System.Data.OleDb.OleDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter(SQLString, oleConn)
    oleConn.Open()
    OleDbDataAdapter.Fill(DataSet, "Facturen")
    DataGridView1.DataSource = DataSet.Tables("Facturen")
    'hier kleuren:
    DataGridView1.AutoResizeColumns()
    checkfactuurvervallen()
    oleConn.Close()
    Catch ex As Exception
    MessageBox.Show("Fout in Database : " & ex.Message)
    oleConn.Close()
    End Try

    Then my sub factuurvervallen:

    Private Sub checkfactuurvervallen()
    'kleur records indien vrij of niet(haal datum vandaag op)
    Try
    Dim vandaag As String = Today
    Dim i As Integer = 0
    For Each row As DataGridViewRow In DataGridView1.Rows
    If DataGridView1.Item(2, i).Value() > vandaag Then
    DataGridView1.Rows(i).DefaultCellStyle.BackColor = Color.IndianRed
    ElseIf DataGridView1.Item(2, i).Value() < vandaag Then
    DataGridView1.Rows(i).DefaultCellStyle.BackColor = Color.LightGreen
    End If
    i = i + 1
    Next
    Catch ex As Exception
    MessageBox.Show("Fout in kleuren aangeven : " & ex.Message)
    End Try
    'tot hier kleuren
    End Sub

    If i pass the sub factuurvervallen() on a button it colors the rows but in my load after loading the rows it doesn't what am i overseeing?? thx in advance

    Visual Basic database question

  • Where and Why my row is not collored
    D DeDelva

    The last one is indeed not true... For your first 2 points thx 4 the advice... So my code between pre thags(sorry 4 that)

    m_SelectedStyle = New DataGridViewCellStyle()
    m_SelectedStyle.BackColor = Color.LightBlue
    m_SelectedStyle.BackColor = SystemColors.Highlight
    DataGridView1.ReadOnly = True
    Dim SQLString As String = "SELECT id, bedrijfsnaam, startdatum, vervaldatum, omschrijving, netto, bruto, opmerkingen FROM Facturen"
    Dim DataSet As New DataSet()
    Dim OleDbDataAdapter As System.Data.OleDb.OleDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter(SQLString, oleConn)
    oleConn.Open()
    OleDbDataAdapter.Fill(DataSet, "Facturen")
    DataGridView1.DataSource = DataSet.Tables("Facturen")
    'here i do the code to check if a field is smaller then a certain date
    Dim vandaag As String = Today
    Dim i As Integer = 0
    For Each row As DataGridViewRow In DataGridView1.Rows
    If DataGridView1.Item(2, i).Value() > vandaag Then
    DataGridView1.Rows(i).DefaultCellStyle.BackColor = Color.IndianRed
    ElseIf DataGridView1.Item(2, i).Value() < vandaag Then
    DataGridView1.Rows(i).DefaultCellStyle.BackColor = Color.LightGreen
    End If
    i = i + 1
    Next

            oleConn.Close()
    

    I hope is more clear now Thx 4 the answers already greetz

    Visual Basic

  • Where and Why my row is not collored
    D DeDelva

    The celformatting is updating all the time... I think it's not a good practice 4 memory use etc... If i place a messagebox in the sub's it's popping up all the time... Anyway Thx greetz

    Visual Basic

  • Where and Why my row is not collored
    D DeDelva

    Try m_SelectedStyle = New DataGridViewCellStyle() m_SelectedStyle.BackColor = Color.LightBlue m_SelectedStyle.BackColor = SystemColors.Highlight DataGridView1.ReadOnly = True Dim SQLString As String = "SELECT id, bedrijfsnaam, startdatum, vervaldatum, omschrijving, netto, bruto, opmerkingen FROM Facturen" Dim DataSet As New DataSet() Dim OleDbDataAdapter As System.Data.OleDb.OleDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter(SQLString, oleConn) oleConn.Open() OleDbDataAdapter.Fill(DataSet, "Facturen") DataGridView1.DataSource = DataSet.Tables("Facturen") 'here the colors starts DataGridView1.Rows(1).DefaultCellStyle.BackColor = Color.Blue Dim vandaag As String = Today Dim i As Integer = 0 For Each row As DataGridViewRow In DataGridView1.Rows If DataGridView1.Item(2, i).Value() = vandaag Then DataGridView1.Rows(i).DefaultCellStyle.BackColor = Color.IndianRed ElseIf DataGridView1.Item(2, i).Value() > vandaag Then DataGridView1.Rows(i).DefaultCellStyle.BackColor = Color.LightGreen End If i = i + 1 Next DataGridView1.AutoResizeColumns() oleConn.Close() Catch ex As Exception blabla End Try Even if i try to just color without conditions it doesnt work something like: DataGridView1.Rows(2).DefaultCellStyle.BackColor = Color.LightGreen But whyyyyy....

    Visual Basic

  • devenv.exe error
    D DeDelva

    code peepz, Why does my vs 2010 is not working anymore??? I googled but nothing had solved the large amount of questions. I get this error: Microsoft visual studio had encounter an error and needs to be closed then i get => mediacontextnotificationwindow : devenv.exe unknown software error (0xe0434352) location : 0x752dd36f Can somebody help me out?? Thx in advance

    Visual Basic visual-studio help question csharp

  • Change Column width from Datagridview without dataset
    D DeDelva

    Thx mate After populating : DataGridView1.AutoResizeColumns() Did the trick... greetz

    Visual Basic question database algorithms help tutorial

  • Change Column width from Datagridview without dataset
    D DeDelva

    Hellow code friends, I was searching 4 a while after my question but most of the time i find answers with a dataset. I'm getting my data from a DB (without envolving a dataset). So My 4th column or column called opmerkingen is to small in width. I just want to set my with to 80 or something when my datagridview is loaded. Can anyone solve my problem in a simple way?? If you answer please do this with an example. there is nothing more clear then an ex... Thx in advance Greetings from a n00b

    Visual Basic question database algorithms help tutorial

  • How to pass values between 2 mdi childs?(without new form)
    D DeDelva

    Dave You are the sh*t (positif ofcourse) Maybe for the people who browse to do the same with a datagridview :

    If DataGridView1.SelectedRows.Count = 0 Then
    RaiseEvent CustomerSelected(DataGridView1.Item(columnindex, rowindex).Value.ToString())
    End If

    Or something... Dave is there is anything i can do 4 you just mail me on facebook (already send you a message) Succes with everything and greetings from belgium

    Visual Basic question css algorithms help tutorial

  • How to pass values between 2 mdi childs?(without new form)
    D DeDelva

    Dave, Thanks again you really are a patient man right?... Anyway, I can find the form and i know that it exists i will pass some code to give you a better view before i stop working with mdi containers.(last question hehe). what i realllllyy need to accomplish is this: Form A is a list of costumers where i can fill in textboxes with data. If i want to change a costumers data i click on a button search. This will go to form B where i can search through a datagridview of custumers.If i click a celrow the row data has to go to form A in the txt's. Form B code:

    If Not (e.RowIndex = -1) Then
    DataGridView1.Rows(e.RowIndex).Selected = True
    End If
    i = DataGridView1.CurrentRow.Index
    formA.TextBox1.Text = DataGridView1.Item(0, i).Value.ToString()

    enso.... simply explained is that i need a formA.show() before it will pass the dgvitems in the txt. I work between 2 mdichildrens so i cannot do this, also not possible the work with new because the form is already opened. Can somebody help me out of this misery??? :( Sorry for bothering greetz & thx dave;)

    Visual Basic question css algorithms help tutorial

  • How to pass values between 2 mdi childs?(without new form)
    D DeDelva

    Thx 4 the reply, Your solution works but not how i wanted... avalue = "hello world" if i load the form where i want to get my data from i do: avalue = "changethevaluethatiwanttohave" so i load that form and avalue is changed (on the form) then if i go to the form where i want to get my data in i do : GetTheValue() but still giving me "hello world" back instead of changetevaluethatiwanttohave... How come?because avalue is declared global but if i change my global var it wil not change when a call the function in the other form?? regards

    Visual Basic question css algorithms help tutorial

  • How to pass values between 2 mdi childs?(without new form)
    D DeDelva

    Hey, First of all thx for the reply,reallllly appreciate that :) Second my apologizes if i'm working on your nerve system. I'm an advanced noob with vb.net But can somebody explain it with some example's? I checked the event tutorial but there must be a faster way no?(don't like to add classes for a single transport). So i like the public method more, but can you show me an example how i should write the method in form b and how to access my values in form a? Thanks again

    Visual Basic question css algorithms help tutorial

  • How to pass values between 2 mdi childs?(without new form)
    D DeDelva

    Hey peepz, After a big torture of searching i came 2 my last hope. Situation : I have a mdiparent where i open mdichild A. From mdichild A, i click a button to open mdichild B. I "simply" want to pass a value from mdichild B to mdichild A(not a new form). Question: How can i get a value from form B to retreive this in form A(bouth mdichilds). form.show =>opens a new form dim formbla as new blabla =>opens also a new form already tried a less best practice : formA.lblDate.Text = DataGridView1.Item(9, i).Value.ToString() but this only works when i use the show method... I'm begging 4 help Somebody? Thx in advance

    Visual Basic question css algorithms help tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups