|
Hi friends ,I select budget monitoring title for my final project, we do our project with VB.net 2003& sql server 2000,Can you help to do my project
Thank You
Your's Friend
|
|
|
|
|
No, you haven't asked any specific questions that we could possibly answer.
|
|
|
|
|
Here is my situation:
My application fill up an ArrayList with numbers from where I need to generate random numbers from this Array...is like picking some numbers ramdonly from this universe of numbers.
I have tried everything I know but no manage to get working.
I will appreciate any sugestions.
Thank all and my regards.
Marcio Muniz
|
|
|
|
|
demasoft wrote: I have tried everything
please explain!
demasoft wrote: no manage to get working
please explain!
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hi Luc..
Ok...suppose you have an ArrayList with values , like:
index value
0 8
1 12
2 17
3 22
4 26
5 34
what i need to do is generate a function to pick for example 3 values randomly from the values on on the ArrayList....like
1st numbers generated: 8, 17, 26
2nd numbers generated: 12,26,34... and so on.
I tried use random using as reference the index of the ArrayList but its generated numbers from the lowest index to the higher one...on this example it will include numbers 9,10,11,13,14...
and i just can use the numbers in the Array.
Got it??
Thanks for your replay.
Marcio
Marcio Muniz
|
|
|
|
|
Marcio
In your function do the following:
let's say variable is names iaNumbers
Randomize()
return iaNumbers(Int(Rnd() * iaNumbers.count))
|
|
|
|
|
Hi nlarson,
have a look at my code...it's just a part of...
when load the form I have the ArrayList filled up and see the numbers on a listbox:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim i As Integer
With arrlst
.Add(4)
.Add(8)
.Add(12)
.Add(19)
.Add(23)
.Add(27)
.Add(28)
.Add(32)
End With
qtd = arrlst.Count
Try
For i = 0 To qtd - 1
ListBox1.Items.Add(arrlst(i))
Next
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
when I clicked on the btn, should generate the random numbers from the ArrayList:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim rndval As New Random()
Dim val As Integer
Dim a As Integer
Dim minval As Integer = arrlst(0)
Dim maxval As Integer = arrlst(qtd - 1)
For a = 0 To 4
Randomize()
val = Int(Rnd() * arrlst.Count)
ListBox2.Items.Add(val)
Next
End Sub
I tried your sugestion but the result brought me numbers that do not exists in the Array.
Thank you for your sugestion.
Marcio
Marcio Muniz
|
|
|
|
|
my code got you the index of the arralist now respond with what the index has in it
change to listbox2.items.add(arrlist(val))
|
|
|
|
|
YOU ARE A CHAMPION.....THANKS A MILLION...
ALL THE BEST!!!!!
Marcio
Marcio Muniz
|
|
|
|
|
How to in VB.NET 2005
It is possible in C# but how in VB ??
Thanks
|
|
|
|
|
like so:
Sub Main()
Dim sb() As String
Dim s As String
sb = sa()
For Each s In sb
Console.WriteLine(s)
Next
Console.ReadLine()
End Sub
Function sa() As String()
Dim saa() As String = New String() {"0", "1", "2"}
Return saa
End Function
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Possible in C# (see ASP Controls Toolkit) ut not in VB?
Thanks
|
|
|
|
|
when by itself, it does appear to blow up.
define a class and pass the array within it and pass the class back and forth...
note: the dll the class is in will need to be on both sides (client and webservice)
|
|
|
|
|
It's done exactly the same way it's done in C#. Though the syntax would be a little different.
|
|
|
|
|
Dave,
I tried it this way and the webserver blew up responding:
<WebMethod()> _
Public Function saTest() As String()
Dim sa(3) As String
sa(0) = "A"
sa(1) = "B"
sa(2) = "C"
Return sa
End Function
|
|
|
|
|
I can't see the error you posted, probably because it's wrapped in tags and you didn't check the "Ignore HTML tags in this message" checkbox before you hit "Post Message".
But, in any case, the code, as you posted it, DOES work.
This sample was done under VS2005, modified for .NET 3.0 and WCF extensions. See if you can guess which method will fail and why?
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
<System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ToolboxItem(False)> _
Public Class Service1
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function GetArrayOfStrings() As String()
Dim strings As String() = {"Some text 1", "Some text 2", "Some text 3"}
return strings
End Function
<WebMethod()> _
Public Function GetArrayOfStrings2() As String()
Dim strings(3) As String
strings(0) = "Some text 1"
strings(1) = "Some text 2"
strings(2) = "Some text 3"
return strings
End Function
<WebMethod()> _
Public Function GetArrayListOfStrings() As ArrayList
Dim list As New ArrayList
list.AddRange(New String() {"Some text 1", "Some text 2", "Some text 3"})
return list
End Function
<WebMethod()> _
Public Function GetListOfStrings() As List(Of String)
Dim list As New List(Of String)
list.AddRange(New String() {"Some text 1", "Some text 2", "Some text 3"})
return list
End Function
End Class
|
|
|
|
|
well something must of been "hung up" in memory because today my code works, where yesterday it blew up the asp.net development server started out of the IDE.
to answer your question:
the last one - casting issue from a string array to a list
|
|
|
|
|
nlarson11 wrote: to answer your question:
the last one - casting issue from a string array to a list
Wrong! Sorry, it was a trick question - none of them fail.
So long as the collection container is tagged Serializable and all of the graph members are ALSO tagged Serializable, the WebMethod will work. A good example of this is the last method. A List(Of T) collection is Serializable and will work as a valid return type in a WebMethod so long as the type in the collection is also tagged Serializable. The String type is, so this works without a problem.
If String was NOT serializable, the same collection would fail when you tried to return it through a WebMethod.
|
|
|
|
|
I took your code as is...only added an imports to system.collection.generic because of using the "list" I received this error:
System.InvalidOperationException: There was an error generating the XML document. ---> System.InvalidCastException: Unable to cast object of type 'System.Collections.Generic.List`1[System.String]' to type 'System.String[]'.
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write5_ArrayOfString(Object o)
at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfStringSerializer2.Serialize(Object objectToSerialize, XmlSerializationWriter writer)
at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
at System.Xml.Serialization.XmlSerializer.Serialize(TextWriter textWriter, Object o)
at System.Web.Services.Protocols.XmlReturnWriter.Write(HttpResponse response, Stream outputStream, Object returnValue)
at System.Web.Services.Protocols.HttpServerProtocol.WriteReturns(Object[] returnValues, Stream outputStream)
at System.Web.Services.Protocols.WebServiceHandler.WriteReturns(Object[] returnValues)
at System.Web.Services.Protocols.WebServiceHandler.Invoke()
|
|
|
|
|
Don't know what to tell you there. It works fine for me under both the development webserver and under IIS6. The machine also has MSXML 4 SP2 and MSXML 6 installed, though I doubt that's the cause.
You might want to restart the web server you're using and try it again.
|
|
|
|
|
I find that webservices pass datasets quite well. So if you don't mind the overhead I would suggest passing a dataset with one table with however many rows you need that have one column.
Ben
|
|
|
|
|
Hello,
VS 2005 & SQL 2005
I have a database field called signature and is an image datatype (binary data).
I am trying to display that signature in a crystal reports.
The signature has been displayed properly in the database as I can display the signature into a picture box using a memory stream. So I know the picture is there.
I am using typed datasets.
In CR i have dragged the signature field on to the crystal report and when i hover the mouse over it comes up with BLOB field.
However, when I run crystal reports it doesn't nothing in that field.
Is something more I have to do to display a picture in crystal reports?
Many thanks,
Steve
|
|
|
|
|
please follow this link it will help u a lot
prasanna
|
|
|
|
|
http://www.neodynamic.com/ND/FaqsTipsTricks.aspx?tabid=66&prodid=1&sid=68
prasanna
|
|
|
|
|
Hi
me n my friend are making a software which v use in schools or coll.
our aim is as following :
There is 1 SERVER names SERVER
there r 4 client pcs names CLIENT1 , CLIENT2 , CLIENT3 , CLIENT4
*********************************************************************
all 4 clients r connected to server via LAN.
Entry work will get done from clients
Database ( SQL ) is on Server.
so i dont know the technology of networking in VB.NET
***********************************************************************
at server,
when client is doing something it will record that all in another database
like >>>>>>>>
when client 2 is finding something ( ther is a search section )
or like that
so can anybody guide me
i gott upto 50%
|
|
|
|