|
CPallini wrote: Oh No, I guess you'll never find a solution for such a difficult problem!
I guess that's why students all over the world is faced with this assignment. The teachers hope that someone might finally solve it.
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
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.
|
|
|
|
|
Just because someone makes fun of you doesn't mean you should delete your posts (I use the plural because you replied to my response with a follow up then deleted it before I realised it was there)
I was going to answer your follow up, but since it is gone it seems rather pointless to continue to try to help.
|
|
|
|
|
Hi
Now i can get the properties and all the things ,storing in an xml file .
I would like to thank to Mr.Dave.K for sharing useful information regarding form designers link .
dvs
|
|
|
|
|
Hi the follwoing code i used for my user control tab events...,
See in that code,i have said the tabs and its subtabs and its url refer sites...,
Now my quest is...,
I like to view the tabs based on the user entry...,
It means i have 2 tables in one table i have said the userid,pagenum..,
Another table i said pagenumber,pagename & pageurl...,
Now using the following code how to display the tabs,sub tabs and its url instead of display static how to dispaly dynamic(based on userid)??????,...
Plz help me,
My static code follows here :
'Adding here main tabs
Dim _Text As ArrayList = New ArrayList
_Text.Add("Admin")
_Text.Add("Guest")
Dim ts As JQD.TabStrip = CType(Me.FindControl("TabStrip1"), JQD.TabStrip)
ts.TabText = _Text
Dim _SubTabText As Hashtable = New Hashtable
'Adding here Sub tabs for that Admin (main) tab
_Text = New ArrayList
_Text.Add("Admin User Login")
_Text.Add("Admin Default Page")
_SubTabText.Add(0, _Text)
'Adding here Sub tabs for that Guest (main) tab
_Text = New ArrayList
_Text.Add("microsoft")
_Text.Add("oracle")
_SubTabText.Add(1, _Text)
ts.SubTabTextCol = _SubTabText
AddHandler ts.SelectionChanged, AddressOf Me.ts_SelectionChanged
Private Sub ts_SelectionChanged(ByVal sender As Object, ByVal e As JQD.TabStrip.SelectionChangedEventArgs)
'Assigning links for that sub tabs
Dim TabPos As Integer = e.TabPosition
Dim SubPos As Integer = e.SubTabPosition
Select Case (TabPos)
Case 0
If (SubPos = 0) Then
src = "Admin1.aspx"
End If
If (SubPos = 1) Then
src = "Admin2.aspx"
End If
Case 1
If (SubPos = 0) Then
src = "Guest1.aspx"
End If
If (SubPos = 1) Then
src = "Guest2.aspx"
End If
End Select
Session("src") = src
End Sub
Regards,
Magi
|
|
|
|
|
If I'm getting this right only 1 of you're 2 tabs should be shown depending on wich user it is.
If that is the case:
you'll have to detirmen wich user is logged in (admin/guest) and act accordantly
it it is admin user only exacute the code for the admin user if its guest only the code for guest
a simple If select would be enough to do this provided that you know wich user is logged on
If my help was helpfull let me know, if not let me know why.
The only way we learn is by making mistakes.
|
|
|
|
|
Hi Dragon,
Thanks For ur reply,
But its not only depend on 2 users...,
Its depend on multiple users...,
Each user have some links and some one have some links extra...,
It will be like that..,,
So we cabnt assign only admin/guest like...,
Regards,
Magi
|
|
|
|
|
in that case the following might be better (I am asuming you have a db with the users in it):
Dim ts As JQD.TabStrip = CType(Me.FindControl("TabStrip1"), JQD.TabStrip)
ts.TabText = _Text
Dim _SubTabText As Hashtable = New Hashtable
_Text = New ArrayList
_Text = New ArrayList
_Text.Add("microsoft --> from db")
_Text.Add("oracle --> from db")
_SubTabText.Add(0, _Text)
ts.SubTabTextCol = _SubTabText
AddHandler ts.SelectionChanged, AddressOf Me.ts_SelectionChanged
Private Sub ts_SelectionChanged(ByVal sender As Object, ByVal e As JQD.TabStrip.SelectionChangedEventArgs)
Dim TabPos As Integer = e.TabPosition
Dim SubPos As Integer = e.SubTabPosition
src = e.tag
Session("src") = src
in plain english (since the above might not be entirly correct) you have the login from the user
so now you create a tabstrip with that login as base.
With that login you can retrieve from the database what the default page is and assign it.
after that you can retrieve all the pages this user has, for each page you create a new tab and (very important) in the tag property (if this exists in asp if not you will have to find another way to pass the page) put the page that needs to be displayed .
then in you're handler class you can simply retrieve the source from this tag property (sender.tag (you might need to cast the sender object to a tabstrip before you get its property's)) and assign it to the session
I hope this helps
if it doesn't help can you paint me a mental picture of how you want this all to look since right now I'm not shure if I have it right and ASP is far from my speciality so I don't know all the controls.
If my help was helpfull let me know, if not let me know why.
The only way we learn is by making mistakes.
|
|
|
|
|
hi guys. beginner here!
following code throws up an formatexception error. unsure how fix the problem
reading from a text file with the data:
Rovers
6
1
1
12500
120000
United
4
2
2
20200
400000
City
1
0
7
8000
85000
Public Class Form1
Private Sub btnOutput_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOutput.Click
Dim sr As IO.StreamReader = IO.File.OpenText("C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\Assessment2\football.txt")
Dim fmtStr As String = "{0, -15}{1, 10:N0}{2, 8:N1}{3, 8:N2}{4, 8:N3}{5, 8:N4}{6, 20:N5}(7, 20:C}{8, 8:P0}"
Dim team As String
Dim played, won, drawn, lost, points, aveA, aveI, perc As Integer
lstbox.Items.Add(String.Format(fmtStr, "Team", "Played", "Won", "Drawn", "Lost", "Points", "AveAttendance", "AveIncome", "%Won"))
team = sr.ReadLine
won = sr.ReadLine
drawn = sr.ReadLine
lost = sr.ReadLine
played = won + lost + drawn
points = (won * 3) + (drawn * 1)
aveA = sr.ReadLine
aveI = sr.ReadLine
lstbox.Items.Add(String.Format(fmtStr, team, won, drawn, lost, points, aveA, aveI, perc))
team = sr.ReadLine
won = sr.ReadLine
drawn = sr.ReadLine
lost = sr.ReadLine
played = won + lost + drawn
points = (won * 3) + (drawn * 1)
aveA = sr.ReadLine
aveI = sr.ReadLine
lstbox.Items.Add(String.Format(fmtStr, team, won, drawn, lost, points, aveA, aveI, perc))
team = sr.ReadLine
won = sr.ReadLine
drawn = sr.ReadLine
lost = sr.ReadLine
played = won + lost + drawn
points = (won * 3) + (drawn * 1)
aveA = sr.ReadLine
aveI = sr.ReadLine
lstbox.Items.Add(String.Format(fmtStr, team, won, drawn, lost, points, aveA, aveI, perc))
sr.Close()
End Sub
End Class
|
|
|
|
|
bjk88 wrote: following code throws up an formatexception error. unsure how fix the problem
reading from a text file with the data:
What is the message of the exception and where did it happen?
|
|
|
|
|
A first chance exception of type 'System.FormatException' occurred in mscorlib.dll
Input string was not in a correct format.
it occurs in the line:
lstbox.Items.Add(String.Format(fmtStr, "Team", "Played", "Won", "Drawn", "Lost", "Points", "AveAttendance", "AveIncome", "%Won"))
|
|
|
|
|
bjk88 wrote: Dim fmtStr As String = "{0, -15}{1, 10:N0}{2, 8:N1}{3, 8:N2}{4, 8:N3}{5, 8:N4}{6, 20:N5}(7, 20:C}{8, 8:P0}"
Dim team As String
Dim played, won, drawn, lost, points, aveA, aveI, perc As Integer
lstbox.Items.Add(String.Format(fmtStr, "Team", "Played", "Won", "Drawn", "Lost", "Points", "AveAttendance", "AveIncome", "%Won"))
If I'm interpreting the format strings correctly, then it is expecting that some of the arguments being passed to the Format method to be numeric. All the arguments are strings. Did you mean to pass strings? Or did you mean to pass the variables with similar (capitalisation differences) names?
|
|
|
|
|
i meant to pass variables with similar names.
the aim is to print out a sort of table such as
team played won drawn lost etc.....
rovers 8 6 1 19
united 8 4 2 2
|
|
|
|
|
bjk88 wrote: i meant to pass variables with similar names.
You mean you meant to pass the strings on this line because if you passed the variables then you would not get the output you have indicated.
Your format string dictates that the input on certain columns will be numeric. You have passed a string. You need to use a formatting string that does not require numeric data for that line.
Also (once you fix this problem), the ReadLine statements will be your next problem, as you are not converting them to numeric data. (Well, at least those that need converting)
|
|
|
|
|
Oh yeah, sorry, the first line added to the lstbox the strings should be passed. After that the variable data read from the text file should be passed.
|
|
|
|
|
bjk88 wrote: lstbox.Items.Add(String.Format(fmtStr, "Team", "Played", "Won", "Drawn", "Lost", "Points", "AveAttendance", "AveIncome", "%Won"))
You can't use string values with a format that expects numeric values.
bjk88 wrote: won = sr.ReadLine
This is an implicit conversion equivalent to:
won = Convert.ToInt32(Double.Parse(sr.ReadLine))
This might not be exactly what you want. You might rather want to use Option Explicit On (to avoid unintended conversions), and do the conversions youself, so that you see what actually happens.
bjk88 wrote: lstbox.Items.Add(String.Format(fmtStr, team, won, drawn, lost, points, aveA, aveI, perc))
You haven't assigned any value to the perc variable.
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
Guffa wrote: You can't use string values with a format that expects numeric values.
How would i go about changing it so it would accept the values?
|
|
|
|
|
bjk88 wrote: How would i go about changing it so it would accept the values?
"{0, -15}{1, 10}{2, 8}{3, 8}{4, 8}{5, 8}{6, 20}(7, 20}{8, 8}"
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
Guffa wrote: "{0, -15}{1, 10}{2, 8}{3, 8}{4, 8}{5, 8}{6, 20}(7, 20}{8, 8}"
I changed to that, but still get the same error.
|
|
|
|
|
Change (7, 20} to {7, 20} .
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
That has worked. Thanks a lot!
Now getting an error at the next lstbox.Items.Add line.
"Index (zero based) must be greater than or equal to zero and less than the size of the argument list."
|
|
|
|
|
Check the arguments in the call, and add the one that is missing.
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
Ive added the one that is missing.
|
|
|
|
|
The code now looks like this:
Public Class Form1
Private Sub btnOutput_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOutput.Click
'Declare variables
Dim team As String
Dim played, won, drawn, lost, points, aveA, aveI, perc As Integer
'Create "zones" for data
Dim fmtStr As String = "{0, -15}{1, 10:N0}{2, 8:N1}{3, 8:N2}{4, 8:N3}{5, 8:N4}{6, 20:N5}{7, 20:C}{8, 8:P0}"
'Read data from football.txt
Dim sr As IO.StreamReader = IO.File.OpenText("C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\Assessment2\football.txt")
'Add headers to the table
lstbox.Items.Add(String.Format(fmtStr, "Team", "Played", "Won", "Drawn", "Lost", "Points", "AveAttendance", "AveIncome", "%Won"))
team = sr.ReadLine
won = CInt(sr.ReadLine)
drawn = CInt(sr.ReadLine)
lost = CInt(sr.ReadLine)
played = won + lost + drawn
points = (won * 3) + (drawn * 1)
aveA = CInt(sr.ReadLine)
aveI = CInt(sr.ReadLine)
perc = (won / played) * 100
lstbox.Items.Add(String.Format(fmtStr, team, won, drawn, lost, points, aveA, aveI, perc))
sr.Close()
End Sub
End Class
With the error appearing in the highlighted line.
|
|
|
|
|
See my previous post.
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|