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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
G

Geoff_3001

@Geoff_3001
About
Posts
25
Topics
9
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Arraylist.Index(Object) help please. [modified]
    G Geoff_3001

    Mr Kuryakin Thanks for the answer this makes sense I did try before posting a compareto function in the plateobj class, which I have successfully used for sorting. Ok so how to use the code you posted. 1) I assume I add this to the plateobj class ? 2) I get an error that suggests instead of using Overides I should use Overloads 3) Dim plate As Plateobj = TryCast(obj, Plateobj)gives two errors - TryCast not declared - 'Plateobj' is a type and cannot be used as an expression. Could I ask you to insert your code into my example and post back. Many Thanks Geoff

    Visual Basic help database tutorial

  • Arraylist.Index(Object) help please. [modified]
    G Geoff_3001

    I am trying to get the index of an object in an Arraylist. Please see my example. When run I get -1 for the values of Indexof. I am sure this is a rookie error but any help would be appreciated. Cheers Public Class Plateobj Public Name As String Public Order As Integer End Class Private Sub Go() Dim Plate As New Plateobj Dim List As New ArrayList 'Populate arraylist Plate.Name = "Geoff" Plate.Order = 3 List.Add(Plate) Plate = New Plateobj Plate.Name = "Dan" Plate.Order = 2 List.Add(Plate) Plate.Name = "Paul" Plate.Order = 1 List.Add(Plate) 'Locate the index of each of the following MessageBox.Show(List.IndexOf(Plate), "Paul") Plate = New Plateobj Plate.Name = "Dan" Plate.Order = 1 MessageBox.Show(List.IndexOf(Plate), "Dan") Plate = New Plateobj Plate.Name = "Geoff" Plate.Order = 3 MessageBox.Show(List.IndexOf(Plate), "Geoff") End Sub

    modified on Friday, November 27, 2009 6:36 AM

    Visual Basic help database tutorial

  • DataGrids and editing values
    G Geoff_3001

    I have created a datagrid that has a coloumn which value is calculated from two other coloums. so the data datagrid column Total = Column Amt * Column Price I would like to capture theevent when a cell is edited and enter or down arrow is pressed. Once the event is triggered I need to asertain the cell row and column details. Then I will add some code to recalculate the data and refresh the grid. So the question. How do I capture the enter after edit of a cell. How do I get the row and column details. Any Help would be apreciated. Thanks

    Visual Basic question css help

  • Passing Arraylists of Objects to Child Form
    G Geoff_3001

    Ok Thanks, Makes sense wil give it a whirl.

    Visual Basic help

  • Passing Arraylists of Objects to Child Form
    G Geoff_3001

    Dave I have renamed both destination obj and arraylist i still get the following error Unable to cast object of type StockObj to NewStockObj. Excepy for the name they are indentical. Cheers

    Visual Basic help

  • Passing Arraylists of Objects to Child Form
    G Geoff_3001

    Hi, I am trying to pass an arrylist to a child form as below. I get an error saying not posible to cast Stockobj to Stockobj. If I change the arraylist to contain strings not objs it works fine. Any clues welcome Thanks Parent Form Public Class Stockobj Public Id As Integer Public Name As String Public Plex As String End Class Private WithEvents MixForm As MixForm Dim StockNameList As New ArrayList 'Code Populates StockNameList Me.MixForm = New MixForm(StockNameList) Me.MixForm.Show() Child Form Public Class Stockobj Public Id As Integer Public Name As String Public Plex As String End Class Dim StockNameList As New ArrayList Public Sub New(ByVal StockAliquots As ArrayList) InitializeComponent() End Sub

    Visual Basic help

  • Help calling a com function from VB.net [modified]
    G Geoff_3001

    Thanks Christian, I wish it were only so. Cheers Geoff

    Visual Basic com csharp xml help

  • Help calling a com function from VB.net [modified]
    G Geoff_3001

    I am trying to call a function in a dll which was written in com I am uing the following Dim myxmlobj As New serviceprovider.ProcessXML Dim returnmesg As String returnmesg = myxml.ProcessXMLFile("c:\myxml.xml") I have a added a reference to Interop.ServicePorvider in my project. All seems correct but the funtion fails (Giving HRESULT E_Fails), is there anything special I need to consider as I am a calling a com dll. Cheers -- modified at 14:03 Saturday 27th January, 2007

    Visual Basic com csharp xml help

  • loading text from a file...
    G Geoff_3001

    Here is some bits of code (not complete) I have used to do somthing similar. 1) it opens the launch.ini file 2) creates a streamreader and puts the content of the file into infile 3) then it reads infile one char at a time building a temp string until it reads a comma (in your case it would be a space) 4) On reaching a comma it stores the value in a string (in the example IP and Mac) Hope this helps you get started. thefile = "c:\launch.ini" Try fs = New FileStream(thefile, FileMode.Open) Catch excep As System.IO.FileNotFoundException Exit Sub End Try Dim sr As StreamReader = New StreamReader(fs) Dim infile As String ' String used to accept file input Dim c As Char Dim count As Integer Dim temp As String infile = sr.ReadToEnd sr.Close() fs.Close() 'MessageBox.Show(infile) count = 0 Do c = infile.Substring(count, 1) count = count + 1 If c <> "," Then temp &= c Loop While c <> "," ip = temp ipbox.Text = ip temp = "" Do c = infile.Substring(count, 1) count = count + 1 If c <> "," Then temp &= c Loop While c <> "," mac = temp macbox.Text = mac temp = ""

    Visual Basic css help

  • Reference to a non-shared member requires an object reference
    G Geoff_3001

    Christian, Thanks a lot for your help, the mud becomes ever clearer. I was calling with as posted, I changed it as you suggested and it fires the method. Of course I now get a new error, but hey no one said it would be easy. Thanks again Geoff

    Visual Basic help csharp com xml

  • Reference to a non-shared member requires an object reference
    G Geoff_3001

    Thanks, I agree that that sounds like the problem from my research. I have no clue how I would provide an instance of the oblect (I more use to borland c++ circa 1992) I found the following in the docs regarding the method HRESULT ProcessXMLFile ([in] BSTR filename, [out, retval] BSTR * errors) ; and Method ProcessXMLFile This method is used to process an XML document stored on disc, and uses the following parameters: Parameter Description BSTR filename File name and path of the XML document. BSTR * errors Output error string. Cheers

    Visual Basic help csharp com xml

  • Reference to a non-shared member requires an object reference
    G Geoff_3001

    Iam currently wirting a vb.net 2003 dll which links to a 3rd party com dll. I have successfuly created a com class project and registerd the dll using regasm. There is very little docs (not a surprize) and when calling the below function ProcessXMLFile("C:\myxl.xml) I get a bulid error saying "Reference to a non-shared member requires an object reference" I have found lots of refrences to this error online, but none that help in this situation. I relise the information is a little thin, not sure I have any more info but if you need more ask and I will try and provide. Thanks in advance

    Visual Basic help csharp com xml

  • Creating an arraylist of an object
    G Geoff_3001

    Hey I solved my own question. The problem with my code was I was returning 1 for greater than an zero for <= . The compare function should return 1 for greater than 0 for equal to and -1 for less than. Phew on to the next stage. Public Class Posts Implements IComparable Public Name As String Public ID As Integer Public Selected As Boolean Public Function CompareTo(ByVal obj As Object) As Integer Implements System.IComparable.CompareTo Dim temp As Posts = CType(obj, Posts) Dim mestxt If Name > temp.Name Then Return 1 ElseIf Name = temp.Name Then Return 0 Else Return -1 End If End Function End Class

    Visual Basic question

  • Creating an arraylist of an object
    G Geoff_3001

    Ok, Iam stuck again I cobbled together a sort metod in by posts class (see below). When I run the code it works ok if my posts have names C,B, and A but if they have C, B and C no sorting occurs. Any Body got any clues pls Public Class Form1 Inherits System.Windows.Forms.Form Public Class Posts Implements IComparable Public Name As String Public ID As Integer Public Selected As Boolean Public Function CompareTo(ByVal obj As Object) As Integer Implements System.IComparable.CompareTo Dim temp As Posts = CType(obj, Posts) Dim vMe As String = Name Dim iMe As Integer = ID Dim mestxt mestxt = "Name=" & vMe & ", Id=" & ID & " Temp name=" & temp.Name & " Temp_ID=" & temp.ID MessageBox.Show(mestxt, "Compare") If vMe < temp.Name Then MessageBox.Show("1") Return 1 End If If vMe > temp.Name Then Return 0 End If End Function End Class Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim oArr As New ArrayList Dim mestxt As String Dim oPost As New Posts oPost.Name = "C" oPost.ID = 1 oPost.Selected = False oArr.Add(oPost) oPost = Nothing oPost = New Posts oPost.Name = "B" oPost.ID = 2 oPost.Selected = True oArr.Add(oPost) oPost = Nothing oPost = New Posts oPost.Name = "C" oPost.ID = 3 oPost.Selected = True oArr.Add(oPost) oPost = Nothing mestxt = "Original -> " For Each oPost In oArr mestxt = mestxt + oPost.Name & ", " Next MessageBox.Show(mestxt) oArr.Sort() oPost = Nothing oPost = New Posts mestxt = mestxt & "Sorted -> " For Each oPost In oArr mestxt = mestxt + oPost.Name & ", " Next MessageBox.Show(mestxt) End Sub End Class

    Visual Basic question

  • Creating an arraylist of an object
    G Geoff_3001

    Thanks That works fine. The bit I was having trouble with was I thought you had to link the obeject to the arraylist somehow. I see now that arrarylist will allow you to add to it with whatever you like there is no need to "preset" it to do so. Thanks again

    Visual Basic question

  • Creating an arraylist of an object
    G Geoff_3001

    Aah Clear concise and I even understand Many Thanks will give it a go. Cheers

    Visual Basic question

  • Creating an arraylist of an object
    G Geoff_3001

    Sorry I was not tring to be difficult, This looks like what I am after I want to create an arrary of the Posts objects (only using this as an example) and the dynamically add to the arrarylist. How would I use the above to create the list of object and add to them. Thanks I am strating to see the answer

    Visual Basic question

  • Creating an arraylist of an object
    G Geoff_3001

    Sorry if this is elsewhere but I look and could not find. Can I / How do I create an arrarylist of an object. For instance for the below object Public Class Posts Public Name As String Public ID As Integer Public Selected As Boolean End Class Cheers Geoff

    Visual Basic question

  • Are arrays of objects possible ?
    G Geoff_3001

    Um I suspect I will end up with other object as I am reading data from oracle and flat data file and writing updates back. I will give it a go though, knowledege is power as they say. Thanks Geoff

    Visual Basic data-structures help question

  • Are arrays of objects possible ?
    G Geoff_3001

    AaaaHa It works thanks, maybe the day was not wasted Cheers Geoff

    Visual Basic data-structures help 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