|
Liqz wrote:
I didn't want to classes because it seemed to be overkill considering my structures only contain 3 maybe 4 properties.
As you are casting the values, I suppose that you are using an untyped collection like ArrayList? In that case, there is no benefit at all using a structure, as each structure value will be boxed inside an object in order for the collection to be able to handle it.
That also means that it's impossible to change the separate properties in place. The value has to be unboxed and copied to a variable, where you can change the property, then the value can be boxed and stored back in the collection.
Liqz wrote: So I thought structures would be more appropriate.
No, that's not a good reason to use a structure. A structure is used when you want value type semantics, but what you have clearly contains several distinct values. Usually a structure is immutable, which means that you don't change a separate property. If you want a different set of properties you create a new structure value.
In this case you should definitely use a class instead. Unless you have a specific reason to use a structure, a class should always be the first choise. A structure can be more efficitent in some cases, but then it's also harder to implement it so that it works properly.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Ah OK, thank you supercat and guffa for your advice. It's given me something to think about. Like I said, I am still learning and all of your advice is very valuable to me. Think I will go away and read up on the correct usage of structures before I continue. Thanks again
|
|
|
|
|
Tried using List(Of T) like you suggested but unfortunately I still get the same compiler error as when using a collection. But thanks anyway. I will go away and look at the other types of collections in VB.NET, but in the mean time will stick to my long winded approach!
|
|
|
|
|
I am a gray haired old fox ...... I started to learn programming using Borlands Turbo C++ 4.5 compiler...
So I know I am bit out of touch with this stuff. All I can remember is the following of the day I wrote a small trig program:
#include <conio.h> // console input output;
#include <iostream.h> // Input/Output Stream Controlling library;
#inlcude <math.h> // Basic math function library;
#include <complex.h> // Complex math formulation library;
int main () // Start of the body of the program;
{ // initial area of program script within the body of the program;
float a,b,c,d; //Float not straight integers but decimals and negatives ectra;
cout<<"Please input the Angle: ";cin>>a;
cout<<"Please Press a key to continue";getch();
cout<<"Please input Adjacent: "cin>>b;
cout<<"Please enter in Hypotenuse: ";cin>>c;
count<<"Please enter in Time in Military 100th seconds: ";cin>>d;
float e,f,g,h;
e=1/(d*3.14);
f=(b/c);
g=(1/d);
h=a*(f*g*e);
count<<your awnser is:"<<h;
}return 0 ;}
This use to work but I might have goofed it up some where.. So any volunteers to help me learn VB @008 Express Edition scripting ?
Cause I am a bit lost and need lots of help and patience
|
|
|
|
|
Teaching programming is far beyond the scope of this, or indeed any, forum. There are thousands of free tutorials on the net which will help you get started. Or, you could even purchase a beginners book. If you then have any specific problems or queries while you are learning, post here and I'm sure someone will be able to help you.
|
|
|
|
|
That's not VB at all, but in comparison to C++ you're in for a much easier time. VB.Net is very simplistic, and unlike C++ it is not archaic or complex (to a certain degree) at all. Infact, if you picked up a book, which I hope you do, the first thing you will usually read is "VB.Net / C# is a RAD language", where RAD is Rapid Application Development. Trust me, go to a local book store, and Microsoft has a great series of books for beginners entitled
"Build a program now! using Visual Basic Express 2008" which is entirely recommended for beginners. It will get you off on the right foot about good practices and the basics of architecture. Check it out, you will have decent applications off the ground in no time.
|
|
|
|
|
hii all
how can i clear the variables?
beginner_VB_user
|
|
|
|
|
Could you be more specific?
You may use .Dispose method to delete objects.
|
|
|
|
|
im using the if...else if..else if... but the value of the variable keep adding..so i want to clear the value of the variable at every else if...
|
|
|
|
|
Set each variable you need to 0?? Without seeing your code, it's difficult to say what you're refering to.
|
|
|
|
|
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox_ByteEn.Text = "" Then
ODLAT_ARM_x_MASK_CTL = ODLAT_ARM_x_MASK_CTL And (Not (&H100000))
Else
If TextBox_ByteEn.Text = "00" Then
ODLAT_ARM_x_MASK_CTL = ODLAT_ARM_x_MASK_CTL Or ((&H100000))
ODLAT_ARM_x_REQ_B = ODLAT_ARM_x_REQ_B Or Convert.ToUInt32(TextBox_ByteEn.Text) * 32
TextBox4.Text = Hex(ODLAT_ARM_x_REQ_B)
ElseIf TextBox_ByteEn.Text = "01" Then
ODLAT_ARM_x_MASK_CTL = ODLAT_ARM_x_MASK_CTL Or ((&H100000))
ODLAT_ARM_x_REQ_B = ODLAT_ARM_x_REQ_B Or Convert.ToUInt32(TextBox_ByteEn.Text) * 64
TextBox4.Text = Hex(ODLAT_ARM_x_REQ_B)
|
|
|
|
|
Wow - that's the ugliest code I've seen for some time. If you want to reset any of these values, then write code to set their values. Duh.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
my first time using VB...
|
|
|
|
|
Is this the first time you've used ANY language (procedural)?? The rules for setting variable values apply to them all, not just VB.
|
|
|
|
|
Most likely downloaded a project and want's to edit it, never seeing a language before.
Some guy pasted: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox_ByteEn.Text = "" Then
ODLAT_ARM_x_MASK_CTL = ODLAT_ARM_x_MASK_CTL And (Not (&H100000))
Else
If TextBox_ByteEn.Text = "00" Then
ODLAT_ARM_x_MASK_CTL = ODLAT_ARM_x_MASK_CTL Or ((&H100000))
ODLAT_ARM_x_REQ_B = ODLAT_ARM_x_REQ_B Or Convert.ToUInt32(TextBox_ByteEn.Text) * 32
TextBox4.Text = Hex(ODLAT_ARM_x_REQ_B)
ElseIf TextBox_ByteEn.Text = "01" Then
ODLAT_ARM_x_MASK_CTL = ODLAT_ARM_x_MASK_CTL Or ((&H100000))
ODLAT_ARM_x_REQ_B = ODLAT_ARM_x_REQ_B Or Convert.ToUInt32(TextBox_ByteEn.Text) * 64
TextBox4.Text = Hex(ODLAT_ARM_x_REQ_B)
Just do ODLAT_ARM_x_MASK_CTL = 0, if it crashes, oh well...
|
|
|
|
|
aswd wrote: ODLAT_ARM_x_REQ_B = ODLAT_ARM_x_REQ_B Or Convert.ToUInt32(TextBox_ByteEn.Text) * 32
You know the value of TextBox_ByteEn.Text, so you don't have to parse it. It's always zero, so the entire statement is actually pointless.
If you want to set the value instead of combining it with the previous value, you just assign zero to the variable.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
I have already installed Fonts of Different Indian Languages(Hindi, Gujarati ..) .
I want to change my change Language of My Application as per Given Option(i.e. i will give option for language, if i select English then whole application will show in English , if Hindi then whole application in Hindi).
For Labels , grids.. it works fine, but problem occurring with textbox input language.
if i select 'Hindi' then 'Hindi' Text must be written in textbox.
|
|
|
|
|
If you're talking about translating words, no font is going to do this for you. You actually have to have some kind of translation software built into your app. This is not something you will find in the .NET Framework. That's IF I understand your question correctly.
|
|
|
|
|
hpcontractor wrote: f i select 'Hindi' then 'Hindi' Text must be written in textbox.
You change the font of that textbox to Hindi. If that font is installed, input characters will appear in Hindi. But your users should know the character map to enter text. Or else you need to integrate some kind of phonetic transliteration to your program.
|
|
|
|
|
N a v a n e e t h wrote: If that font is installed, input characters will appear in Hindi.
Thanks for Reply,
Hindi Font is installed, and if i select Language Hindi from 'Language Bar' , then i can write in Hindi in Textbox, but can i do same thing from code?
|
|
|
|
|
hpcontractor wrote: Hindi Font is installed, and if i select Language Hindi from 'Language Bar' , then i can write in Hindi in Textbox, but can i do same thing from code?
when you select language from 'Language Bar' then change font of text box
|
|
|
|
|
default font of system in English. Hindi font is already installed.
When I select Language Hindi from 'Language Bar' , then i can write in Hindi in Textbox.
But, i want that user can able to write it in Hindi even if not select it from 'Language Bar'
|
|
|
|
|
Can u give more detail about how currently ur changing fonts of label & grids ? so i can suggest u answer.
|
|
|
|
|
I am having trouble on calling a function on my code behind.. here's my code..
MPEConfirm = New AjaxControlToolkit.ModalPopupExtender<br />
Dim popup As LiteralControl = New LiteralControl<br />
PnlConfirm = New Panel<br />
btnConOK = New Button<br />
btnConCancel = New Button<br />
'asp panel for modal popup<br />
With PnlConfirm<br />
.ID = "PnlConfirm"<br />
.CssClass = "modalPopup"<br />
.Attributes.Add("Style", "display: none")<br />
.Height = 100<br />
.Width = 233<br />
End With<br />
<br />
With btnConOK<br />
.ID = "btnConOK"<br />
.CssClass = "Buttons"<br />
.Text = "Yes"<br />
.Width = 50<br />
End With<br />
arrbtnConOK(l) = btnConOK<br />
AddHandler btnConOK.Click, AddressOf btnConOK_Click<br />
<br />
With btnConCancel<br />
.ID = "btnConCancel"<br />
.CssClass = "Buttons"<br />
.Text = "No"<br />
.Width = 50<br />
End With<br />
AddHandler btnConCancel.Click, AddressOf btnConCancel_Click<br />
<br />
popup = New LiteralControl("<br /><div align='center'>")<br />
PnlConfirm.Controls.Add(popup)<br />
'popup = New LiteralControl("<span style='font-size:10px;color:white;font-family:Verdana'>Are you sure you want to continue without saving?</span><br /><br />")<br />
'PnlConfirm.Controls.Add(popup)<br />
popup = New LiteralControl("<span style='font-size:10px;color:white;font-family:Verdana'>Do you want to save the changes that you made?</span><br /><br />")<br />
PnlConfirm.Controls.Add(popup)<br />
PnlConfirm.Controls.Add(btnConOK)<br />
popup = New LiteralControl(" ")<br />
PnlConfirm.Controls.Add(popup)<br />
PnlConfirm.Controls.Add(btnConCancel)<br />
popup = New LiteralControl("</div>")<br />
PnlConfirm.Controls.Add(popup)<br />
<br />
For l = 0 To dt.Rows.Count - 1<br />
<br />
imgExpand = New ImageButton<br />
With imgExpand<br />
.ID = "imgExpand_" & l<br />
.ImageUrl = "~/Files/images/expand_blue.gif"<br />
.CommandName = l<br />
.CommandArgument = dt.Rows(l)("core_id")<br />
End With<br />
AddHandler imgExpand.Click, AddressOf imgExpand_Click<br />
<br />
'modalpopup extender<br />
With MPEConfirm<br />
.ID = "MPEConfirm" & l<br />
.TargetControlID = "imgExpand_" & l<br />
.PopupControlID = "PnlConfirm"<br />
.BackgroundCssClass = "modalBackground"<br />
'.OkControlID = "btnConOK"<br />
'.CancelControlID = "btnConCancel"<br />
End With<br />
arrMPEConfirm(l) = MPEConfirm<br />
PnlCoreComp.Controls.Add(imgExpand)<br />
PnlCoreComp.Controls.Add(arrMPEConfirm(l))<br />
Next<br />
PnlCoreComp.Controls.Add(PnlConfirm)
i disabled okControlID and CancelControlID to be able to disregard the client script and the button would go directly to the function on my code behind.. my problem is, my function won't trigger even if i added event handler on my button.. any idea?
yours truly,
hyperalergelo
modified on Tuesday, February 3, 2009 12:42 AM
|
|
|
|
|
Have you tried defining your UI in the aspx instead of through code ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|