CodeVerge.Net Beta
Login Idy
Register Password
  Forgot?
   Explore    Item Entry    Profile    Invite   History    Resources   SiteMap  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML




Zone: > newsgroup > asp.net forum > starter_kits_and_source_projects.dotnetnuke.custom_modules Tags:
Item Type: NewsGroup Date Entered: 6/20/2005 8:00:40 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 0 Views: 3 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
4 Items, 1 Pages 1 |< << Go >> >|
codegalaxy
Asp.Net User
Converting a string to a system color or unit6/20/2005 8:00:40 PM

0/0

I have a few settings comming into my module that define some controls (like backcolor and width) I am saving them and getting them back as strings but I keep getting

Value of type 'String' can not be converted to 'System.........

How whould I convert them?

[heres what I have tried]

<code>

myControl.Width = CType(mySplit, System.Web.UI.WebControls.Unit)


</code>
Dylan Barber
Dylan's Blog

RLyda
Asp.Net User
Re: Converting a string to a system color or unit6/20/2005 8:27:50 PM

0/0

Try something like this....Set & Get:


    Public Sub SetColor(ByVal strXPath As String, ByVal strAttribName As String, ByVal clrValue As System.Drawing.Color)

        SetAttrib(strXPath, strAttribName, clrValue.ToArgb.ToString)

    End Sub


    Public Function GetColor(ByVal strXPath As String, ByVal strAttribName As String, ByVal clrDefault As System.Drawing.Color) As System.Drawing.Color

        Dim clrValue As System.Drawing.Color

        Try
            clrValue = System.Drawing.Color.FromArgb(CInt(GetAttrib(strXPath, strAttribName, clrDefault.ToArgb.ToString)))
        Catch
            clrValue = clrDefault
        End Try
        Return clrValue

    End Function


Robert

steve.fabian
Asp.Net User
Re: Converting a string to a system color or unit6/20/2005 8:30:18 PM

0/0

You can use the .parse method

<code>
Dim sWidth as string = "150"
objLabel.Width = System.Web.UI.WebControls.Unit.Parse(sWidth)
</code>
Steve Fabian
w: http://www.gooddogs.com/dotnetnuke
sit, stay, code ... good boy!
codegalaxy
Asp.Net User
Re: Converting a string to a system color or unit6/20/2005 8:33:25 PM

0/0

cool thanks
Dylan Barber
Dylan's Blog

4 Items, 1 Pages 1 |< << Go >> >|



Search This Site:





Other Resources:
ng.borland-forums.borland-public-delphi-language-delphi-dotnet - Web ... Function to return any enumerated type from a string. 2. 2. 1/9/2008 10:10:00 PM ... Programming Language : Delphi/Kylix Operating System ...
Unit Structure (System.Web.UI.WebControls) You can convert other data types to a Unit by using the Parse, Percentage, Pixel, ... As System.EventArgs) primaryStyle.BorderColor = _ Color.FromName ...
system code Unit testing is doomed when it's an elephant. 10 Online Magazines for ... to java string text system clipboard cut paste by whitetiger on Oct 26, 2006 ...
Font Class (System.Drawing) string selectedString = (string) ComboBox1.SelectedItem; // Convert it to lowercase. ... Reset the font to the // new size, using the current unit. ...
Keith Rull - How To: Creating a .NET Color Chart revisited ... the enum to a string array and adding those values(only non-system colors) to List<strings> ... in our string array(colorNames) and convert those names ...
COLORS - Color Conversion ... a set of routines for converting numerical color specifications. ... And I wish I knew a good way to convert to and from the Munsell color description system! ...
 
All Times Are GMT