|
How I can Add Templates Column at Run Time in the .aspx Page in VB.NET
yogesh
|
|
|
|
|
You can't, the aspx is processed before the code behind. Your best bet is probably a repeater, which means you have full control over what is rendered, and can better change it at runtime.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi all
I have a game where i input winning items each with a number and picture. I enter only winning numbers in xml file so when any one plays the game, he/she only wins if winning number is entered. I dont have a ratio for winning items. What i want is to apply a random ratio for winning items.
Forexample out of 100% wins i want the wins to be as follows:
20% item1
30% item2
25% item3
25% item4
please note that in the game i can add as many items as i want.
Any ideas and thanks
|
|
|
|
|
Set up your percentage, then use a random number generator. In the example above, get a number between 1 and 100. 1-20 is item1, 21-50 is item2, 51-75 is item3, 76-100 is item4.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Iam still confused about setting up items. The case is that i dont have a fixed number of items to set up percentages, the items may vary from one time to another. If this is the case how it is this doable?
Lets suppose i fixed my winning item number to 4 items with percentages (40,30,20,10)and i used the random function
Dim RandomNumber1 As Integer
RandomNumber1 = RandomClass.Next(0, 40)
Dim RandomNumber2 As Integer
RandomNumber2 = RandomClass.Next(41, 70)
Dim RandomNumber3 As Integer
RandomNumber3 = RandomClass.Next(71, 90)
Dim RandomNumber4 As Integer
RandomNumber4 = RandomClass.Next(91, 100)
Then what?
Then only if i chosed a number between 91 & 100 i win an item4 and so on, which is not my case. I want a ratio of (40,30,20,10) of the four existing items and a ratio of (35,25,15,15,10) of my five items and so on.
Any ideas and thanks
|
|
|
|
|
If the list is random, how is the spread going to be set ? If it's not also random, then you can store a list of values to compare against, to get the same end result.
samerh wrote: RandomNumber4 = RandomClass.Next(91, 100)
This is not what I said. Take ONE random number between 1 and 100, then work out which interval it fits into. That's how you get your percentage spread. This make not give you any hits at all.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
if you want to assign to each item a random percentage, dynamically, use the following:
(1) Assign to each item ratio a random number
(2) rescale the assigned ratios to sum up to 100 (i.e. normalize).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Yeah, that's what I said.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hello
Can you provide me a simple function of how to use Progress bar while pulling an unknown number of data from a database
thx
Regards
Ramy
|
|
|
|
|
Quite plainly, if you don't know how much data you are getting, there's no way you can show a real progress bar. You should also try to make your database call all in one go, not breaking it up into many calls if you can help it.
Your best bet is to set a progress bar to just show indeterminate progress ( the bar moves over and over ) and leave that showing while a thread does your DB call.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
ya tats right.. i had posted the same question days ago, and got the same answer from the members of this group. Any ways, try to loop the value of the progressbar with the number of recordsets you want to load. Place the function in a timer with an interval of say 1000 ms.
hope this works..
The name is Sandeep
|
|
|
|
|
Kindly,Provide me a simple code for that
thank you
Regards
Ramy
|
|
|
|
|
What he has suggested is plain not going to work. Set your progress bar Style property to Marquee and do what I said, there is just no way you can show a progress bar for an unknown number of items.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Thx for ur help
I really appreciate it. ( and i m not complaining)
all what i ask is a simple code please
thx
Regards
Ramy
|
|
|
|
|
If you set the progress bar style to marquee, it will display itself automatically. Just put one on your form, and then do your database call in a thread. When the thread ends, get rid of the progress bar. I'm sorry, but I don't write VB, and really, there's no code that I can show you, you need no code for the progress bar, and I don't know how your database call is written.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
thx for ur help
Regards
Ramy
|
|
|
|
|
Christian Graus wrote: I'm sorry, but I don't write VB
then start writing and THEN give your suggestions...
So whats the idea?? Changing the style of the progress bar? wats the matter if u get the count of the records that has to be processed..(as i said earlier)
Christian Graus wrote: there's no code that I can show you
but i can show you..
With flxTest
.Clear
.Rows = 1
.Cols = 5
Call GetConnection 'Function
Set Gadors = New ADODB.Recordset
GNewQuery = "SELECT * FROM test"
Gadors.Open GNewQuery, Gadocn
Gadors.MoveFirst
Dim i As Long
pg.Min = 0 'setting values of progressbar
pg.Max = Gadors.RecordCount
MousePointer = vbHourglass
While Gadors.EOF = False
i = .Rows
.Rows = .Rows + 1
.TextMatrix(i, 0) = Gadors.Fields(0)
.TextMatrix(i, 1) = Gadors.Fields(1)
.TextMatrix(i, 2) = Gadors.Fields(2)
.TextMatrix(i, 3) = Gadors.Fields(3)
.TextMatrix(i, 4) = Gadors.Fields(4)
If pg.Value <> Gadors.RecordCount Then pg.Value = pg.Value + 1
Gadors.MoveNext
flxTest.Refresh
Wend
MousePointer = vbDefault
End With
try this one....
The name is Sandeep
|
|
|
|
|
Your updating the progress bar AFTER the records have been returned, not during. Your only updaating the progress bar during the processing of each record.
For a long running stored procedure that returns a set of records, or for an unknown size of the set, this won't work at all.
|
|
|
|
|
Xandip wrote: then start writing and THEN give your suggestions...
Most of the questions here are framework questions, which is why I can answer them. I *can* write VB, but I'd prefer not to.
Xandip wrote: but i can show you..
Like Dave said, this won't work. What I explained, will.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
In the case of stored procedures, I admit what Dave said. But I dont understand why you are saying to display a progressbar in the screen just for a Show sake. Whats the use of it, if it doesnt show even the approximate time taken for loading the set of records..?
The progressbar loading is used for making the user wait upto some time, till the data shows up. If its the case of stored procedures, my code can be inserted during the data loading time, because stored procedures still shows the recordcount. At least, the user can see the time spent in the data showup process.
Christian Graus wrote: What I explained, will.
I really dont like the idea of fooling a user with your 'just for show' progressbar. I admit that my idea is not the appropriate solution, but still I can't stand with yours.
The amount of time for presenting the data in front of the user can be precisely split up into the
time for data retrieval + time for data viewing
time for data retrieval -> this one, i admit, cannot be done
time for data viewing -> but you have to admit, this one can be done
The name is Sandeep
|
|
|
|
|
Is This for VB6 or VB.NET??
The name is Sandeep
|
|
|
|
|
guys
it's a vb.net application
fdbcon.Open()
fdbcmd.CommandText = "select * from table"
dr = fdbcmd.ExecuteReader
fdbcon.Open()
that is all
Regards
Ramy
|
|
|
|
|
So use the BackgroundWorker class to do this in a thread, and in it's finished event, hide the progress bar. Your only other problem is, do you also disable the rest of the UI during the call ? The easiest way to do that is have a modal call on a progress dialog, which calls the thread, and then closes itself when the call is done.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
hi guys..
when i close my exe, i want it to close with a fade effect..
does anyone know bout it..??
The name is Sandeep
|
|
|
|
|
Set the opacity in a loop, calling Invalidate and Application.DoEvents so they get shown, then close the form.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|