|
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%
|
|
|
|
|
ankur0101 wrote: 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
Why not use a standard SQLClient to write to the database directly from each client?
ankur0101 wrote: when client is doing something it will record that all in another database
like >>>>>>>>
I don't understand what ">>>>>>>>" means. Are you trying to write to a table that for example a user clicked on a button, selected a combo box, etc?
ankur0101 wrote:
when client 2 is finding something ( ther is a search section )
or like that
Again, are you trying to record the action (button click, etc) or are you trying to write a search result to the database?
Pete Soheil
DigiOz Multimedia
http://www.digioz.com
|
|
|
|
|
hi,
Now i am phasing one problem in datagrid
according to the numbers the rows can be segrigate ie no :1's are in one color and no:2's are in one other color .....
plz help me to solve this problem
prasanna
|
|
|
|
|
Select the GridView in question, and under properties look for "AlternatingRowsDefaultCellStyle". Click on the selection combo, and select a color under "Backcolor" for it. That's all you need to do.
Pete Soheil
DigiOz Multimedia
http://www.digioz.com
|
|
|
|
|
Hi I am trying to make a login program. I want to use access 2003 to keep track of the usernames/passwords so the program can just check with access to see if the username matches the password and if so let them continue with the program.
Here is my code so far.
'Max Bunnell
Public Class LoginForm
Dim Times As Double
Dim Username As String
Dim Password As String
Private Sub ResetButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ResetButton.Click
Me.PasswordTextBox.Text = ""
Me.UsernameTextBox.Text = ""
End Sub
Private Sub SubmitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SubmitButton.Click
If Times < 3 Then
Username = Me.UsernameTextBox.Text
Password = Me.PasswordTextBox.Text
If Username = "mcbunnell" Then
If Password = "x1236598" Then
MessageBox.Show("Congradulations", "You got it right!", MessageBoxButtons.OK)
Me.PasswordTextBox.Text = ""
Me.UsernameTextBox.Text = ""
Times = 0
Username = ""
Password = ""
Me.Close()
Else
MessageBox.Show("Wrong Username And/Or Password", "Login Error", MessageBoxButtons.OK)
Me.UsernameTextBox.Text = ""
Me.PasswordTextBox.Text = ""
Times = Times + 1
Username = ""
Password = ""
End If
Else
MessageBox.Show("Wrong Username And/Or Password", "Login Error", MessageBoxButtons.OK)
Me.UsernameTextBox.Text = ""
Me.PasswordTextBox.Text = ""
Times = Times + 1
Username = ""
Password = ""
End If
End If
End Sub
Private Sub LoginForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Times = 0
End Sub
End Class
|
|
|
|
|
What is your question? Because the only thing we can see from this is that you spelled congratulations wrong.
|
|
|
|
|
how do i make the first connection with access
|
|
|
|
|
|
Other than you have no database code at all in this, there's already a bunch of things wrong with your code.
For instance, doesn't repeating this:
Me.UsernameTextBox.Text = ""
Me.PasswordTextBox.Text = ""
...
Username = ""
Password = ""
four times in this little code segment just scream "put me in my own method!"??
|
|
|
|