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
C

Codemonkey85

@Codemonkey85
About
Posts
36
Topics
11
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Writing IR data transmitter / receiver for Pocket PC 2003 (VB.Net)
    C Codemonkey85

    I have been trying to use socket communications so far, but whether I use that or serial communications, I'm having trouble just setting the connection up in the first place. I've actually been trying to understand how to use either in a desktop setting as well, to no avail. For the socket communication option, I am having problems defining the EndPoint for the Socket.Connect method. This is what I have so far:

        Dim IR As Socket = New Socket(AddressFamily.Irda, SocketType.Stream, ProtocolType.Unspecified)
    
        Dim EP As System.Net.EndPoint
    
        Dim SA As System.Net.SocketAddress
    
        SA = New System.Net.SocketAddress(AddressFamily.Irda, 1)
    
        EP.Create(SA)
    
        IR.Connect(EP)
    
        IR.Send(New Byte() {1})
    
        IR.Close()
    

    This doesn't work because the EndPoint (EP) has not been assigned a value. EndPoint also does not use a New constructor, so I guess I'm just not sure how to declare it. I would just use the IRDA namespace, but my project is (like so many others') meant to communicate with remote controls and other "dumb" IR devices, rather than communicating with another Pocket PC or Windows based device. I realize the complications involved in communicating with such a device, but right now my main concern is even being able to send or receive any data at all. I figure I'll sort out the data format after that. Anyway, I don't know C++, but I will check out that link and see if I understand it.

    As I sit here, I contemplate the last words of Socrates: "I drank what?". Pokémon Pearl Friend Code: 4554-2418-6836

    Visual Basic csharp help tutorial question

  • Writing IR data transmitter / receiver for Pocket PC 2003 (VB.Net)
    C Codemonkey85

    Hello, I am trying to write a program for my Pocket PC 2003 edition, which can receive and / or transmit IR data. I know that depending on the device, I will need to know some very specific information to properly send the data that I will want to send. However, for the time being, I would be happy just knowing how to send any old bytes of data that I choose. The problem mainly lies in the fact that I don't know Socket programming, I guess. So far all I have is:

    Dim IR As Socket = New Socket(AddressFamily.Irda, SocketType.Stream, ProtocolType.Unspecified)

    Where do I go from here, if I wanted to use the Socket I declared (IR) to send or receive data through my Pocket PC's IR port?

    As I sit here, I contemplate the last words of Socrates: "I drank what?". Pokémon Pearl Friend Code: 4554-2418-6836

    Visual Basic csharp help tutorial question

  • Applications Won't Launch!
    C Codemonkey85

    Well, I tried uninstalling and reinstalling the framework, as well as VB.Net. I even tried a system restore. Nothing has changed. Now what? EDIT: Hmm, now breakpoints in both the Form1 Load event and the Application's startup event are working, as is (apparently) any code I put in there. But beyond those two subs, nothing happens, and the form never appears on the screen. What the heck.

    As I sit here, I contemplate the last words of Socrates: "I drank what?". Pokémon Pearl Friend Code: 4554-2418-6836

    modified on Tuesday, December 16, 2008 11:47 PM

    Visual Basic help csharp com debugging

  • Applications Won't Launch!
    C Codemonkey85

    Hello, I need some serious help... for some reason, rather recently, any application I try to develop on my home PC will not launch. It doesn't launch out of debug mode (debug mode starts and ends almost instantly), it doesn't launch if I try to run the compiled .exe from Explorer, and worse yet, an application that I develop at work (where I don't have this problem) will no longer launch if I compile it on my home PC! Even if I make a new application from scratch, just a blank form with no controls, that won't launch. I even tried Console.WriteLine("Some message") in the Form1 Load event and in the Application's Startup event and nothing gets written to the Output window. No error ever gets reported either. I've already tried uninstalling VB.Net and reinstalling it, and that didn't help either. I've looked all over MSDN[^] and Google, and no one else seems to have this problem. I don't know what else to do!

    As I sit here, I contemplate the last words of Socrates: "I drank what?". Pokémon Pearl Friend Code: 4554-2418-6836

    Visual Basic help csharp com debugging

  • VB.Net Thumbnail For File Based On Contents, Associate File With Program
    C Codemonkey85

    The file association has to be done programmatically, for deployment purposes... although that method would be fine for my personal use (if I could then figure out how to set my program to know what to do once the file is opened in this fashion). I'll look into those links you provided. I may be in over my head, but something tells me someone else has tried something like this. Thanks!

    As I sit here, I contemplate the last words of Socrates: "I drank what?". Pokémon Pearl Friend Code: 4554-2418-6836

    Visual Basic csharp hardware help tutorial

  • VB.Net Thumbnail For File Based On Contents, Associate File With Program
    C Codemonkey85

    Hello, I am creating a program in VB.Net that reads data from a specific file type (one that I didn't create). Part of my program reads the file to determine some of the data in it, references an embedded resource image (choosing which image based on said data), and displays that image in a picturebox. I would like for these files to display a thumbnail of that same image in Explorer. I'd be all right with an explorer-like interface in my program that does this, but I'd much prefer if it could be applied to Explorer, so I can see these thumbnails even without the program running. I've looked for information on how to do this everywhere, and I can't find any. In a similar vein, I would like to associate these files with my program, so that when I double click them, my program launches and knows what to do with that file (basically it would run the functions it runs now, only without the need for an openfiledialog). Any help (or points in the right direction at least) would be really appreciated. Thanks everyone!

    As I sit here, I contemplate the last words of Socrates: "I drank what?". Pokémon Pearl Friend Code: 4554-2418-6836

    Visual Basic csharp hardware help tutorial

  • Importing XLS file to DataTable
    C Codemonkey85

    Yeah, tried that... see this thread[^] I dunno. I'll keep trying different things, but if anyone has ever done anything like this again and has some code (or can at least figure out what's wrong with my code), I would appreciate it a bunch. Thanks!

    As I sit here, I contemplate the last words of Socrates: "I drank what?". Pokémon Pearl Friend Code: 4554-2418-6836

    Visual Basic database question learning

  • Importing XLS file to DataTable
    C Codemonkey85

    Yeah, I'm now trying to figure out how to read data from the Access file.

    As I sit here, I contemplate the last words of Socrates: "I drank what?". Pokémon Pearl Friend Code: 4554-2418-6836

    Visual Basic database question learning

  • Importing XLS file to DataTable
    C Codemonkey85

    I have done many things. And I've performed at least ten Google searches and tried everything I've seen. But for some unbeknownst reason to me, I can't seem to get what I want. It seems like it should be a simple matter to read data from a spreadsheet and use that data as you please, but for example, I can't seem to retrieve the correct data from my DataTable even when I think I finally populated it with the spreadsheet data. I don't think it was even meant to be used that way, honestly.

    As I sit here, I contemplate the last words of Socrates: "I drank what?". Pokémon Pearl Friend Code: 4554-2418-6836

    Visual Basic database question learning

  • Importing XLS file to DataTable
    C Codemonkey85

    Yeah, I tried using oledb before, and for some reason certain cells came up blank for no apparent reason. I dunno. I could try that Access thing too, I guess. Frankly, I'm about to pull my hair out on this one. Thanks!

    As I sit here, I contemplate the last words of Socrates: "I drank what?". Pokémon Pearl Friend Code: 4554-2418-6836

    Visual Basic database question learning

  • Importing XLS file to DataTable
    C Codemonkey85

    How would I define a DataTable? By the looks of it, you specify it as a source for another object or something. This might not even be the right way to do what I want to do, bear in mind. I'm looking for any easy way to store the data from my sheet so that I can programmatically retrieve it.

    As I sit here, I contemplate the last words of Socrates: "I drank what?". Pokémon Pearl Friend Code: 4554-2418-6836

    Visual Basic database question learning

  • Importing XLS file to DataTable
    C Codemonkey85

    Whoops!

    Imports Microsoft.Office.Interop
    Imports System.Runtime.InteropServices
    Imports Microsoft
    Imports System.Data
    Imports System.Data.OleDb

    Public Class Form1
    Dim WithEvents xlBook As Excel.Workbook

    'DataTable:
    '104 Rows
    '91 Columns
    '\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
    Dim ItemDataTable As DataTable
    '\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
    Dim con As OleDbConnection
    Dim da As OleDbDataAdapter
    Dim ds As New DataSet
    Dim fileName As String = ""
    Dim New\_Column As DataColumn
    Dim New\_Row As DataRow
    
    Dim ItemTable As New DataTable
    

    Some of this stuff is unused in this example, like the OleDb stuff.

    As I sit here, I contemplate the last words of Socrates: "I drank what?". Pokémon Pearl Friend Code: 4554-2418-6836

    Visual Basic database question learning

  • Importing XLS file to DataTable
    C Codemonkey85

    What I want to do for my company is turn our price book into a desktop application. I figured I could use an external file for the price data, for future editing purposes. I've been trying to do this in different ways for a while now, and it's sort of frustrating (this is my first real exposure to database programming and the like). So I'm trying to read an Excel File into a DataTable. I have a sub going, but for some reason I keep getting a null reference exception: System.NullReferenceException was unhandled Message="Object reference not set to an instance of an object."

    Private Sub ReadExcelData()
        'Try
    
        xlBook = GetObject("C:\\Documents and Settings\\Administrator.OFFICE2\\Desktop\\Michael\\All\_Item\_Prices\_2008.xls")
        Dim xlsSheet As Excel.Worksheet = xlBook.Worksheets(1)
    
        xlBook.Application.Visible = True
        xlBook.Windows(1).Visible = True
        xlBook.Application.WindowState = Excel.XlWindowState.xlMinimized
    
        Dim irow As Integer = 1
        Dim icol As Integer = 1
    
        'DataTable:
        '104 Rows
        '91 Columns icol irow
    
        'For icol = 1 To 91
    
        'xlsSheet.Cells(ROW, COLUMN).value
        MsgBox(xlsSheet.Cells(1, icol).Value.ToString)
        If xlsSheet.Cells(1, icol).Value <> Nothing Then
            New\_Column = New DataColumn \_
            (xlsSheet.Cells(1, icol).Value.ToString)
        Else
            New\_Column = New DataColumn("FILLER " & icol)
        End If
        '\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
        'NULL REFERENCE HAPPENS HERE
        ItemDataTable.Columns.Add(New\_Column)
        'NULL REFERENCE HAPPENS HERE
        '\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
        'For irow = 1 To 104
        'MsgBox(xlsSheet.Cells(irow, icol).Value)
        'ItemDataTable.Rows.Add = xlsSheet.Cells(irow, icol).Value.ToString
        New\_Row = ItemTable.NewRow
        New\_Row.Item(icol) = xlsSheet.Cells(irow, icol).Value.ToString
        'Next
        'Next
    
       'Catch
        'End Try
    End Sub
    

    If someone can tell me either what I'm doing wrong, or knows a better way (I have all of the prices and stuff saved as an Excel spreadsheet), please let me know. I would really appreciate it!

    As I sit here, I contemplate the last words of Socrates: "I drank what?". Pokémon Pearl Friend Code: 4554-2418-6836

    Visual Basic database question learning

  • Using CSV File As Data Reference
    C Codemonkey85

    I haven't really figured out all of the debugging tools yet, to be honest. I'll have to try the step through thing (when I get time, tomorrow probably). And I can load any data into a datatable, I've done it before. The CSV was an Excel spreadsheet that I exported, so I think it's well-formed. But what could cause the code to just stop executing at a certain point? I have it clearly setup as a For loop to run until 114 or something, and it stops at like, 3.

    As I sit here, I contemplate the last words of Socrates: "I drank what?". Pokémon Pearl Friend Code: 4554-2418-6836

    Visual Basic help data-structures tutorial question

  • Using CSV File As Data Reference
    C Codemonkey85

    But... I can't move the data to a Datatable. That's my problem. It isn't working. Is there something wrong with my code? I tried doing it that way, and also reading the file line by line as previously suggested. The data stops being read after like, the third column. And I don't know why.

    As I sit here, I contemplate the last words of Socrates: "I drank what?". Pokémon Pearl Friend Code: 4554-2418-6836

    Visual Basic help data-structures tutorial question

  • Using CSV File As Data Reference
    C Codemonkey85

    So, I followed your advice and tried going with a data table. However, my code is just plain not producing results. I frequently ask my code to msgbox me values here and there to see what's going on, and the last batch of code I posted, as well as this one, seems to ignore these msgbox requests, or the code is somehow not executing. I'm not getting a message box. Below is the sub that I run when the form loads:

    Private Sub ReadCSVToDataTable()
    'http://vbcity.com/forums/topic.asp?tid=119121

        'Dim dt As New DataTable 'class level
    
        'in a method
        Dim constr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\;Extended Properties=""text;HDR=Yes;FMT=Delimited"""
    
        Dim conn As New OleDbConnection
        conn.ConnectionString = constr
        Dim cmd2 As New OleDbCommand
    
        cmd2.Connection = conn
        cmd2.CommandText = "Select \* From All\_Item\_Prices.csv"
        Dim da As New OleDbDataAdapter(cmd2)
        Try
            da.Fill(dt)
        Catch ex As OleDbException
            MessageBox.Show(ex.Message)
        End Try
    
        Dim row0col1 As String = dt.Rows(0).Item(1).ToString
    
        'In the above code, the following assumptions were made:
        '1) file is located in F:\\ directory
        '2) file name is testA.txt
        '3) the file is a comma delimited file
        '4) the file does not contain a header row
    
        'MsgBox(dt.Rows(1))
    
    
    End Sub
    

    Any ideas?

    As I sit here, I contemplate the last words of Socrates: "I drank what?". Pokémon Pearl Friend Code: 4554-2418-6836

    Visual Basic help data-structures tutorial question

  • Using CSV File As Data Reference
    C Codemonkey85

    Okay, so I'm trying to make a program that refers to a table of prices for various items. The problem I am having is being able to easily retrieve data from the CSV file... I can read from it, but I want to store it to an easy-to-use lookup table so that I can pull whatever kind of information I want at any given time. To test this, I tried to make a program that consists only of a listbox, which upon loading of said program would be populated with the names of all of our items. But so far, I cannot figure out how to store this data. I tried using a multidimensional string array, but for some reason my code isn't working. It seems like the program gets to a certain point in my code and stops doing what it's supposed to do, and the functions end and I'm staring at my form. Can anyone help me with this? I would really appreciate it!

    Imports System.IO
    Imports System.Data.OleDb

    Public Class Form1

    Dim ITEM\_FILE\_PATH As String = ""
    Dim ITEM\_FILE As String = ""
    Dim ITEM\_LIST As String(,)
    Dim ITEM\_LINE As String()
    Dim fs As FileStream
    Dim sR As StreamReader
    Dim frstComma As Integer = 0
    Dim thisLine As String = ""
    Dim NumLines As Integer = 0
    
    Private Sub ReadCSVFile()
        ITEM\_FILE\_PATH = Application.StartupPath & "\\All\_Item\_Prices.csv"
    
        fs = New FileStream(ITEM\_FILE\_PATH, FileMode.Open)
        sR = New StreamReader(fs)
    
        sR.ReadLine()
        'ITEM\_FILE = sR.ReadToEnd
    
        While sR.EndOfStream = False
    
            thisLine = sR.ReadLine
            NumLines += 1
            'MsgBox(thisLine)
            frstComma = InStr(thisLine, ",")
            thisLine = thisLine.Substring(frstComma, thisLine.Length - frstComma)
            frstComma = InStr(thisLine, ",")
            thisLine = thisLine.Substring(frstComma, thisLine.Length - frstComma)
            frstComma = InStr(thisLine, ",")
            thisLine = thisLine.Substring(frstComma, thisLine.Length - frstComma)
            'MsgBox(thisLine)
            Dim COMMAS As String = ",,"
            For i As Integer = 2 To 6
                'MsgBox(COMMAS)
                thisLine = Replace(thisLine, COMMAS, "")
                'MsgBox(thisLine)
                COMMAS &= ","
            Next
            'ITEM\_FILE &= thisLine & vbNewLine
            'For iC As Integer = 0 To thisLine.Split(",").Count
            '    ITEM\_LINE(iC) = thisLine.Split(",")(iC)
            'Next
            MsgBox(thisLine)
            MsgBox(thisLine.Split(",").Cou
    
    Visual Basic help data-structures tutorial question

  • Drag & Drop from PictureBox to Explorer to Generate .bmp File
    C Codemonkey85

    Well, I got my answer... http://forums.msdn.microsoft.com/en-US/vblanguage/thread/919c8485-21aa-4db8-80f3-3e98b5e83708/[^] Thanks anyway!

    As I sit here, I contemplate the last words of Socrates: "I drank what?".

    Visual Basic csharp com linux question

  • Drag & Drop from PictureBox to Explorer to Generate .bmp File
    C Codemonkey85

    I could try that, but I'm not exactly at expert level, and this article wasn't really geared toward PictureBox images... as a matter of fact, I don't think it covers dragging to Explorer to generate files at all. Does anyone have any experience or knowledge about this specific problem?

    As I sit here, I contemplate the last words of Socrates: "I drank what?".

    Visual Basic csharp com linux question

  • Drag & Drop from PictureBox to Explorer to Generate .bmp File
    C Codemonkey85

    Hello, I've been trying to drag & drop an image from a PictureBox to Explorer to create a .bmp file of said image, and I've had no success. I've looked and looked all over the 'Net, found a couple of hopeful looking solutions, but nothing has actually worked. I've played around with drag & drop, and I can move a picture between two PictureBoxes okay. I was kind of thinking if there was a way to get a string of the path in which I am attempting to drop the image, I could just save it, but I don't know if that's the best way or if it's even possible. Does anyone know how this could be done? EDIT: I saw the article here[^], but it's in C#... I only know Visual Basic.

    As I sit here, I contemplate the last words of Socrates: "I drank what?".

    Visual Basic csharp com linux question
  • Login

  • Don't have an account? Register

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