|
HI Gurus. I am trying to generate a Table with dynamic controls in different
cells. I am at the same time generating Validation controls and assigning
"control to validate" property to the ID of the generated controls. The
generation works as expected, however when I press the submit button,
validation controls do not react. I posted the code below for the entire
table. In the last line I add the table to a session and regenerate the table
in the Page_Init between postbacks. Can anyone suggest why the validation
does not fire? BTW the "Causesvalidation" property of the submit button is
"ON". In advance, many thanks.
For counter = 0 To CInt(qty - 1)
tRow = New HtmlTableRow
tRow.ID = "fltRow" & counter
'mile cells
tCell = New HtmlTableCell
tCell.ID = "cellMile" & counter
tCell.Width = "20px"
txbMile = New TextBox
txbMile.ID = "txbMile" & counter
validator = New RangeValidator
validator.ControlToValidate = "txbMile" & counter
validator.Type = ValidationDataType.Integer
validator.MinimumValue = txbStartMile.Text
validator.MaximumValue = txbEndMile.Text
validator.Text = "*"
validator.ErrorMessage = "The value must be between " &
txbStartMile.Text & " and " & txbEndMile.Text
txbMile.Width = New System.Web.UI.WebControls.Unit(30)
tCell.Controls.Add(txbMile)
tCell.Controls.Add(validator)
tRow.Cells.Add(tCell)
'chain Cells
tCell = New HtmlTableCell
tCell.ID = "cellChan" & counter
tCell.Width = "20px"
txbchain = New TextBox
validator = New RangeValidator
validator.Type = ValidationDataType.Integer
validator.ControlToValidate = "cellChan" & counter
validator.MinimumValue = txbStartYards.Text
validator.MaximumValue = txbEndYards.Text
validator.Text = "*"
validator.ErrorMessage = "The value must be between " &
txbStartYards.Text & " and " & txbEndYards.Text
txbchain.Width = New System.Web.UI.WebControls.Unit(30)
txbchain.ID = "txbChain" & counter
tCell.Controls.Add(txbchain)
tRow.Cells.Add(tCell)
'fault Cells
tCell = New HtmlTableCell
tCell.ID = "cellFault" & counter
tCell.Width = "80%"
' validator = New RangeValidator
txbFault = New TextBox
txbFault.ID = "txbFault" & counter
recValidator = New RequiredFieldValidator
recValidator.ControlToValidate = "txbFault" & counter
recValidator.Text = "*"
recValidator.ErrorMessage = "Please add the fault"
txbFault.Wrap = True
txbFault.TextMode = TextBoxMode.MultiLine
txbFault.Width = New System.Web.UI.WebControls.Unit(400)
tCell.Controls.Add(txbFault)
tRow.Cells.Add(tCell)
'add created row to the table
tableFaults.Rows.Add(tRow)
Next
tableFaults.Width = "100%"
tableFaults.Border = "1"
tableFaults.ID = "tblFaults"
pnlFaults.Controls.Add(tableFaults)
Session("tableFaults") = tableFaults
Phillie
|
|
|
|
|
Hi all,
How to determine the line number and the column number of Notepad acoording to the posion of the cursor/caret.
Thanks And regards
Samik Karmakar
Samik
|
|
|
|
|
Hi all,
How to determine the line number and the column number of Notepad acoording to the posion of the cursor/caret.
Thanks And regards
Samik Karmakar
Samik
|
|
|
|
|
Basically, you can't. Notepad doesn't expose any such API.
In theory, you could probably calculate it, but you would have to get the text from the textbox in Notepad, get the font that it's using, get the window dimensions, and get the status of the Word Wrap option. Not at all easy from your application, since Notepad doesn't support plug-in's.
Then you'll have to calculate the length of a line, using the Word Wrap status, window dimensions, font size, ..., yada, yada, yada, ...
It would be easier if you just wrote your own Notepad! Start with a TextBox on a form...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi guys.
need some help
i have created a window service with connects to sql 2000 as insert some records after every 30 min. the service is working fine but the problem is that it is consuming a lot of memory. can any one tell me how to reduce that consumption of memory. i m thinking to change the process priority will it help
or there is some other solution.
bi
abhinav
|
|
|
|
|
If your looking in TaskManager, then your looking in the wrong place to see how much memory your app is actually using. What your seeing in the memory RESERVED for the .NET runtime, or virtual machine, that your app is running inside of. This, by no means, is an indicator of your app keeping a stranglehold on that memory. The .NET Memory Manager will release any memory back to the system that Windows needs for other things.
And, no, changing the process priority will have no effect at all on that processes memory consumption.
Basically, there's nothing to do to get the memory footprint down. Just let the Memory Manager do it's job.
Now, that, of course, assumes that your code is written properly. If your allocating huge numbers of objects or keeping large numbers of records in datasets, unnecessarily, then you need to rewrite parts of your app to reduce it's memory consumption. But only you will know if that's even possible.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
thanks dave i think i found the problem.
thanks a lot
abhinav
|
|
|
|
|
Hi Guys
I hope some body can help me, to tell me how to format decimal value wittout round up ?
Many thank for you
ICE
|
|
|
|
|
If you want to simply format have a look at the documentation of the formatstrings (i.e. tostring method documentation or format function).
|
|
|
|
|
Mr.Briga
Thank you for youra reply, actually I have ever tried to use Format string but I still got the decimal in rounding up state. The format string which was I used is "###.00"
I have a example:
I have three Textbox ( textbox1,textbox2,and textbox3) result from textbox1 divide to textbox2 will store in textbox3,
on textbox1 I enter 12000 and on textbox2 I enter 10039, actually the result must be 1.19 store in textbox3, but when I run this program on textbox3 I see 1.20 not 1.19 as I need.
Could you please to tell me how should Itype the right format on Textbox3 in order to get the right decimal format like I need.
Thank you
ICE
|
|
|
|
|
It seems from this article: VB Format string Rounding[^] that what you are seeing is by design.
I found this by googling "vb format string rounding".
...Steve
|
|
|
|
|
Than it's more about rounding/truncating rather than formatting.
If you want to truncate to a certain digit you can use several approaches, two are here:
1)
Function TruncateToDecX(v as double,d as double) as double
v=v/d
v=int(v)
v=v*d
return (v)
end function
You use it passing v=1.1999 and d=0.01 (where you want to truncate) you get 1.19
2) Quick and dirty
dim s as string=v.tostring
s.substring(0,s.indexof(".")+2)
|
|
|
|
|
Hi all,
Someone say that, C# is stronger than VB.Net.
What do you think?
Can you help me to list the strength of C# that VB.Net hasn't.
Nice day.
Thanks.
inew
|
|
|
|
|
This topic has been discussed at length on The Code Porject many times. Have a scan of the older articles and board topics and I'm sure you'll find something.
in summry - there are some differences between the languages and what they can provide function-wise, however it's really a matter of taste which language you use especially since they (mostly) compile to the same CLR for the .NET platform.
There are strong arguments for and against borh. I use both - most of my code these days is in VB because that seemed to be the 'lowest common denominator' (i.e. everyone understood it) but my background is largely in C/C++ so I sometimes feel more at home with C#.
...Steve
|
|
|
|
|
Hi,
During the Code mode, my mouse Scroll is not functioning. is there anywahy how and make it works?
icdavid
|
|
|
|
|
icDavid wrote: During the Code mode, my mouse Scroll is not functioning. is there anywahy how and make it works?
Do you mean that you cannot scroll the text editor (source code) window using the scroll wheel on your mouse? If so, I don't believe that that window supports scrolling by that method.
...Steve
|
|
|
|
|
I have VB6 code windows, and explorer and properties windows scrolling using Logitech Mouseware 9.79 software with an optical Logitech mouse on Windows 2000
|
|
|
|
|
The VB6 IDE does not support the mouse scroll wheel.
icDavid wrote: there anywahy how and make it works?
Yep. Upgrade to VB.NET.
|
|
|
|
|
|
WOW! Thanks a bunch!!! It works.
|
|
|
|
|
Hi everyone,
Problem: Not able to initialize or set the selected index of a combobox after adding a datasource.
Situation: a combobox set on a usercontrol. The user control is set onto a form. The initialization or resetting of the selected index occurs within the load function of the usercontrol. I can reset the selected index on load if the code is within the form load function, but once I move the code to the usercontrol load function I cannot reset the index until another event is fired.
Tried: I have tried to set the selected index to -1 twice, I have read that the .net comobox has that quirk in it.
Code:
Private Sub UserControl1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Call loadData()
Call Me.combobox1.selectedIndex = -1
Call Me.combobox1.selectedIndex = -1
End Sub
Does anyone out there know why this occurs and how I can solve this problem? or maybe a url/link to a solution to this problem? Thank you for looking at the post and all your help everyone.
eatwork
|
|
|
|
|
Can some one help me? I just migrated an App in 2003 to 2005 but I used Hash method to encrypt and decrypt a value but in VS 2005 I didn't give the same result as in VS 2003 is written in C#
It's suppose to send a string and give me numeric value back but I run it and it's not the same value in the app made in 2003 that in 2005
Israel
|
|
|
|
|
You used what to encrypt your string?
That wasn't a good idea. You just found out why.
What's wrong with using the encryption classes built into the .NET Framework? They follow standards-based encryption algorithms and work the same from .NET version to .NET version.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I've created a Crystal report which connects to an Access database to get its data. I have a Crystal report viewer control on my VB form to view the report. When I run the app on another computer and try to view the report a database login screen comes up. The screen has the wrong file path to the database it is trying to connect to. Typing in the right path makes it work but how can I have it automatically know what the correct file path is?
Thanks
|
|
|
|
|
Are you giving the COMPLETE path to the viewer when you launch it from your code?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|