9 Replies - 4186 Views - Last Post: 14 August 2012 - 04:16 PM Rate Topic: -----

#1 angleofphase  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 12-August 12

error message 'Write is not a member of Integer', new to vb

Posted 12 August 2012 - 03:58 AM

Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        On Error Resume Next
        Dim comport As Integer
        Dim onstate, outstring
        onstate = 0
        If Button1.Text = "Pin 6 on" Then
            Button1.Text = "Pin 6 off"
            onstate = 1
            outstring = "!"
        End If
        If Button1.Text = "Pin 6 off" And onstate = 0 Then
            Button1.Text = "Pin 6 on"
            outstring = "$"
        End If
        comport.Write(outstring)
    End Sub


sorry about no tags, I copied & slightly altered the code. I have been studying VB with little success, My main area of expertise is electronic circuit designing & building. I really want to learn VB, any advice or hlp would be GREATLY appreciated! I'm building an interface between VB & arduinos to control items around the house, all is complete except for the VB end - I'm starting with just one button to simplify things. Thank you for your time!

This post has been edited by smohd: 12 August 2012 - 04:33 AM


Is This A Good Question/Topic? 0
  • +

Replies To: error message 'Write is not a member of Integer', new to vb

#2 smohd  Icon User is offline

  • Critical Section
  • member icon


Reputation: 1819
  • View blog
  • Posts: 4,627
  • Joined: 14-March 10

Re: error message 'Write is not a member of Integer', new to vb

Posted 12 August 2012 - 04:40 AM

First of all next time use :code: and explain the error message you are getting.
Your comport is an integer and the Integer class dont have Write method. What do you want to do exactly here?
If you are trying to write to something, then you dont need integer there, you will need classes related to Writers...

Also dont use On Error Resume Next, use try catch instead and catch your errors.
Was This Post Helpful? 0
  • +
  • -

#3 angleofphase  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 12-August 12

Re: error message 'Write is not a member of Integer', new to vb

Posted 12 August 2012 - 07:16 PM

View Postsmohd, on 12 August 2012 - 04:40 AM, said:

First of all next time use :code: and explain the error message you are getting.
Your comport is an integer and the Integer class dont have Write method. What do you want to do exactly here?
If you are trying to write to something, then you dont need integer there, you will need classes related to Writers...

Also dont use On Error Resume Next, use try catch instead and catch your errors.


I am new to VB... I relayed the error code I got - If I knew how to explain it, I likely wouldn't have needed to ask for help. As stated, I copied the code, & don't know what"class don't have write method" or "try catch " means! I really do want to learn - I'm not asking anyone to write code for me, I only want some tips (clearly) on how to proceed. Please someone have some compassion for a newbe & give me a hand at learning!
Was This Post Helpful? 0
  • +
  • -

#4 angleofphase  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 12-August 12

Re: error message 'Write is not a member of Integer', new to vb

Posted 12 August 2012 - 07:29 PM

As for what I'm doing, I have all the electronics in place to interface with an arduino to turn garage & outdoor lights on & off, open & close all 3 garage doors, turn garage furnace on & off, & compressor... & several other things. I am starting the code with only 1 button to start with to simplify the learning process & will add 12 buttons labeled in all. I already have in place an led panel in my office to tell me when these items are on also. I'm very excited about finishing the interface so it will be complete; I am proficient at arduino programming.
Was This Post Helpful? 0
  • +
  • -

#5 torind_2000  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 57
  • View blog
  • Posts: 292
  • Joined: 22-August 11

Re: error message 'Write is not a member of Integer', new to vb

Posted 13 August 2012 - 06:24 AM

View Postangleofphase, on 12 August 2012 - 10:16 PM, said:

I am new to VB...

Lots of us are "new to VB", including this guy, but that's no excuse for a poorly thought out post.
We can't help you without better information, don't just slap up some code and expect miracles to happen.

View Postangleofphase, on 12 August 2012 - 10:16 PM, said:

As stated, I copied the code, & don't know what"class don't have write method" or "try catch " means!

Problem number one, you copied the code and you have no idea what it does.
Google vb.net classes and you get this.
Google Try/Catch vb.net and you get this.
Google is your best friend if you don't have any books.

View Postangleofphase, on 12 August 2012 - 10:16 PM, said:

I really do want to learn

There are so many resources available to learn. I'd advise you to buy a book or 12.

View Postangleofphase, on 12 August 2012 - 10:16 PM, said:

I'm not asking anyone to write code for me, I only want some tips (clearly) on how to proceed.

He gave you some tips (clearly) but it looks like you're going to choose to ignore them.

View Postangleofphase, on 12 August 2012 - 10:16 PM, said:

Please someone have some compassion for a newbe & give me a hand at learning!

We help those who are willing to help themselves.
There's plenty of tips there in his post to get you started.
Was This Post Helpful? 0
  • +
  • -

#6 angleofphase  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 12-August 12

Re: error message 'Write is not a member of Integer', new to vb

Posted 14 August 2012 - 01:13 AM

First off, I'm an electrical engineer, not a computer programmer. I feel somewhat offended by the remarks that have been made... ok, maybe I haven't made myself clear on this; I AM willing to help myself, & am in the process of taking VB.net courses. In addition, I'm not choosing to ignore his tips - that was an assumption on your part... I was not understanding what he was trying to convey. Furthermore, I didn't just copy code that I have no idea of it's meaning; see attachment. I'm really not trying to come across wrong here, just some mis-understanding on both sides. I admit to being a dummy when it comes to VB, that's why I'm seeking help lol! I would like to give this another chance, but I don't take kindly to being insulted. I'm sure you'd be lost in my profession as well. Please be patient with me here, & I'm sure I'll catch on!
P.S. I'm also not the best with forums - I'm doing my best...
Was This Post Helpful? 0
  • +
  • -

#7 angleofphase  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 12-August 12

Re: error message 'Write is not a member of Integer', new to vb

Posted 14 August 2012 - 02:10 PM

reading this the next day, in retrospect, I sincerely hope I've not offended anyone. I fully realize that both responses were sent with good intentions, & I appreciate it more than you know. I'm not great at conveying what I mean or need - I hope you all can understand & work with me. I didn't mean to come across as a jerk, that's not who I am... just really need some assistance & don't quite know how to ask lol! thank you for your time.
Was This Post Helpful? 0
  • +
  • -

#8 trevster344  Icon User is offline

  • The Peasant
  • member icon

Reputation: 224
  • View blog
  • Posts: 1,507
  • Joined: 16-March 11

Re: error message 'Write is not a member of Integer', new to vb

Posted 14 August 2012 - 03:02 PM

Let's simplify this with full disregard to all that has been said. What do you want to do exactly? This can be a simple question, or it can be a complex one. If you want to control your garage door, or something else you will need to break it down. Think of it in Object Oriented terms your garage door is the object, but it is made up of many objects. So what do you need to do to accomplish this? Are you using some kind of programming api provided by the hardware's provider? If so please name it out, although there are many of us proficient in programming in VB.Net this does not mean we can just open up our compilers, write some lines of code, and instantly control our garage doors. So as I said before break it down, and help us help you. If you've already begun somewhere, then where have you begun? What's the problem with where you have begun? Is there an error of some sort? What kind of error? Get used to these kinds of questions, and this thinking when posting here it will help structure your posts. :) Now in regards to what you have said, you'll need to use some kind of com port class. So I suggest using the System.io.port serial port class.

Serial Ports MSDN
Was This Post Helpful? 0
  • +
  • -

#9 angleofphase  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 12-August 12

Re: error message 'Write is not a member of Integer', new to vb

Posted 14 August 2012 - 03:43 PM

Thank you very much for your reply! I do believe I'm close to having it right; I am using a serial port (named comport) to communicate with the arduino - which will do the bulk of the work. Please see the attachment I've provided;It pretty well explains the way the interface functions with the arduino(even I caught on to it easily) I removed some irrelevant items from the code, & am just starting with one button to get it right, then will expand to 12 buttons. the only error code i'm getting is "Write is not a member of Integer". not quite sure what I have to change, but I have come across a VB.net cheat sheet that explains quite a lot. I'll try reworking the code & post the revision, but any hints you could throw my way will be appreciated! All the electronics & hardware I designed & built myself, except the arduino, so I'm following no programming protocol other than the attachment. There are likely some obvious blunders i'm making, but am going at the VB coursework every spare moment... I believe, at least, that i'm on the right track; just need someone who knows much more than I to let me know. Thanks in advance for your time & expertise - if you need more info(I imagine you will), I check this thread many times a day & will respond promptly!
Was This Post Helpful? 0
  • +
  • -

#10 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2267
  • View blog
  • Posts: 9,482
  • Joined: 29-May 08

Re: error message 'Write is not a member of Integer', new to vb

Posted 14 August 2012 - 04:16 PM

Problem with your code, then learn the skill of debugging

All the methods available on Integer.

Is there one named Write? No

Advice reread post 2 snd the post above your last reply.

Why do you keep post a .Doc file? What is it's purpose? Is there reason for it on each post? are they different? Cos I ain't downloading to find out.

This post has been edited by AdamSpeight2008: 14 August 2012 - 04:19 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1