Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8936367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:12:04+00:00 2026-06-15T10:12:04+00:00

I got a console application that draws line in a 3D CAD program. Now

  • 0

I got a console application that draws line in a 3D CAD program. Now to make this more clear i want to change these lines in different colors.

My code read variables from a text-file and calculates data from it and then makes a lines from this calculated data.
This process gets repeated with every line in the text file wich contains data.

Now i want visual basic to change the color everytinme a new line is drawn, so i get different colored lines.

I tried using a For.. To.. Step method, but this didnt work. I also tried to use the variables from my text file( these are different so when a new line got read the RGB code will change) but this will geve me only a lot of blue colors.

Any suggestions?

EDit:

This is what i use to draw the curves, the RGB code has to cahnge everytime when a line with new data is made:

' Creating a Curve2d object by using the above defined points
                    objLineString = objLineStrings.AddByPoints(PointCount:=points, points:=dataArray)
                    objGeometricStyle = objLineString.Style
                    color = objGeometricStyle.LinearColor
                    objGeometricStyle.LinearColor = RGB(0,0,0)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T10:12:05+00:00Added an answer on June 15, 2026 at 10:12 am

    What about :

    Dim rand As New Random() ' Used to generate random numbers
    Dim colors(100) as Integer
    
    ' Create the colors
    For i as Integer = 0 to 100 Step 1
        colors(i) = RGB(rand.Next(256), rand.Next(256), rand.Next(256))
    Next
    
    For i As Integer = 0 To 100 Step 1 ' Adjust to your needs
        ' Creating a Curve2d object by using the above defined points
        objLineString = objLineStrings.AddByPoints(PointCount:=points, points:=dataArray)
        objGeometricStyle = objLineString.Style
        color = objGeometricStyle.LinearColor
        objGeometricStyle.LinearColor = colors(i Mod 100) ' Mod returns the remainder of i / 100, so it's always less than 100.
    Next
    

    This won’t always give you “pretty” colors, but they’ll be different for each line. If you want control over the generated colors, you could set up an array of predefined colors and use these in your iteration.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a console application that i got to make and i would like
I've got a .NET application that uses Remoting between an Administration Console and a
I got stuck right now. Firstly i made Java application that i run from
I've got a console application that compiles and executes fine with Visual C++ 6.0,
This is a console application that I am developing using VS2010 in C#. II
I've got a small C# (.NET 4.0) Console Application that I'd like the user
I've got an unmanaged c++ console application in which I'm using srand() and rand().
i've got a pretty simple .NET console application. I wish to pass in some
So I've got a ServiceReference added to a C# Console Application which calls a
I've got a console app that loads up a datatable; I'd like to export

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.