|
we are working on the project controlling pc thru mobile ..
we are getting an error in the function parse mail as"invalid procedure call or argument"pls tell us how to rectify tat error...thanx in advance..
the code is as follows...
Private Function ParseMail() As String
On Error GoTo ErrTrap
'
'Parameters
'
'Purpose This procedure will check and let us know what action to be
' taken aginst the command sent from mobile
'
''
'Returns String - Command parsed from the mail
'
'
'Set up our variables
Dim oApp As Outlook.Application 'Create an object for outlook application
Dim oNpc As NameSpace 'Name space to drildown message folder
Dim oMails As MailItem 'To find our mail
Dim sCommand As String
Dim iMsgCount As Integer
Dim sMsgHead As String
'Lets apply values to our variables
Set oApp = CreateObject("Outlook.Application")
Set oNpc = oApp.GetNamespace("MAPI")
iMsgCount = 0
'Lets iterate through an easy For Each loop
For Each oMails In oNpc.GetDefaultFolder(olFolderInbox).Items
If oMails.UnRead Then
sParam = ""
'Change the Subject comparition string based on your service provider message
If UCase(oMails.Subject) = UCase(Trim(txtSubject.Text)) Then
sCommand = Mid(oMails.Body, 1, InStr(1, oMails.Body, Chr(13)) - 1)
If InStr(1, sCommand, "~") <> 0 Then
ParseMail = Mid(sCommand, 1, InStr(1, sCommand, "~") - 1)
sParam = Mid(sCommand, InStr(1, sCommand, "~") + 1)
Else
ParseMail = sCommand
End If
oMails.UnRead = False
End If
' If Send Unread mail Header is checked then send info to mobile
If chkUnReadMail.Value = 1 Then
If UCase(oMails.Subject) <> UCase(Trim(txtSubject.Text)) Then
If InStr(1, sAlertedMails, Trim(oMails.EntryID)) = 0 Then
sAlertedMails = sAlertedMails & Trim(oMails.EntryID) & ","
sMsgHead = "From: " & oMails.SenderName & vbCrLf
sMsgHead = sMsgHead & "Sub: " & oMails.Subject & vbCrLf
sMsgHead = sMsgHead & "DT: " & oMails.SentOn & vbCrLf
sMsgHead = sMsgHead & "MSGID: " & oMails.EntryID & "~"
SendSMS sMsgHead
End If
End If
End If
End If
Next oMails
Exit Function
ErrTrap:
txtLog = txtLog & "Error In ParseMail(): "
txtLog = txtLog & Err.Description & vbCrLf
End Function
waiting for your earliest reply..
pls help us with tat error..
|
|
|
|
|
You haven't said on which line the problem occurs. But, from the error message, you probably sent an incorrect argument to a method call somewhere. Without knowing on which line the error occured, it's pretty much impossible to tell you what went wrong.
|
|
|
|
|
Hi all
Can some one plz tel me what is the difference between textbox.text = "" and textbox.clear.
The same thing works for some some other controls also. ????
|
|
|
|
|
Basically both do the same task
We can blank a textbox control by assinging a blank string ie "" or by calling its Clear method
|
|
|
|
|
To make it worse, there's also
Textbox.Text = String.Empty Since it is a reference-type, you could even say
Textbox.Text = Nothing In programming there's seldom a single way or approach to do something
I are troll
|
|
|
|
|
Hi.
I need to read the news feed for example (http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/uk/rss.xml) and store the news part alone in a text file . I can get the content and store in a html file with TortugaActiveX. I need to do in vb 2008. I can use the text data for msagent. Please any one can help me..?
Thanks
Surej
|
|
|
|
|
So what part of this are you having problems with?? Downloading the file?? Parsing the XML?? Saving the data?? ......??
|
|
|
|
|
I can download the file ..I need parsing the XML file so i can get only the news part and save as a text file ..That i can use for msagent. I tried activex from chilkat too..i could not get the desired result
Thanks
Surej
|
|
|
|
|
Any easy way to do this..?
|
|
|
|
|
I'm trying to upload a file in VB.NET using an HtmlInputFile, but everytime I upload, the HtmlInputFile's PostedFile is Nothing.
Here is my ASP.NET code:
<form id="Form1" method="post" runat="server" enctype="multipart/form-data">
<asp:DataGrid id="dgTitles" runat="server" OnUpdateCommand="dgUpdate" DataKeyField="ID">
<Columns>
<asp:TemplateColumn HeaderText="Title" >
<ItemTemplate>
<asp:Label ID="lTitle" Runat="server">
<%# DataBinder.Eval(Container, "DataItem.Title" )%>
</asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="tTitle" Runat="server" text='<%# DataBinder.Eval(Container, "DataItem.Title" )%>'>
</asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Image">
<EditItemTemplate>
<input id='fuEditImage' type="file" name="fuEditImage" runat="server" enctype="multipart/form-data" />
</EditItemTemplate>
</asp:TemplateColumn
<asp:EditCommandColumn UpdateText="Update">
</asp:EditCommandColumn>
</Columns>
</asp:DataGrid>
</form>
Here is my VB.NET code:
Sub dgUpdate(ByVal sender As Object, ByVal e As DataGridCommandEventArgs)
Try
Dim Title = CType(e.Item.FindControl("tTitle"), TextBox).Text
Dim fuUpload As System.Web.UI.HtmlControls.HtmlInputFile = CType(e.Item.FindControl("fuEditImage"), _
System.Web.UI.HtmlControls.HtmlInputFile)
If Not fuUpload.PostedFile Is Nothing Then 'This always = false
If Not fuUpload.PostedFile.FileName = "" Then
UploadImage(fuUpload)
End If
End If
Catch ex As Exception
'Handle Exception here
End Try
End Sub
When I upload a file, fuUpload is not Nothing, but fuUpload.PostedFile is.
The inputted "Title" text is recognized no problem.
I've also tried with FileUpload object and tag, instead of input tag and HtmlInputFile-- same result.
Can anyone tell me what I'm doing wrong? Why is PostedFile always nothing?
Thanks!
|
|
|
|
|
This question should really be asked in the ASP.NET Fourm. It has nothing to do with VB.NET at all.
|
|
|
|
|
Hi All,
I have a requirement for a tool/application/website that can help us to audit the security groups that an owner owns in Active Directory. I need an application that can do the following:
1. List the groups an owner owns (we have a database that contains group name, ads path, owner information hence the code can be linked with the database to get the information)
2. Owner of a group could select the group and veiw the members of that group (May be the code needs to be linked with AD to get the members of the group)
3. Using the tool we should be able to send the email to all the members of a selected group or specific members of the group ( This is required for audit purpose. owner needs to check with the members of the group if they still needs access to the group or not hence need to send an email. As a group can have hundreds of members, sending a manual email to everyone is time consuming). The email should contain a link which can take the user probably to one of the interfaces of our tool- that we need to develop. It should ask the member- do you still need access to the group and have two choices- yes and No. If the user selects Yes and submits nothing should happen. If the member selects No and submits it , member should be automatically removed as a member of the group and the owner of the group should be notified about the change (through an email or something).
I am not sure which programming language or scripting can help me to achieve this application. Any help will be greatly appreciated. It would be great if someone can take it up for me. I can give you the information that you may need for this project. You can let me know your terms and conditions.......if both of us agree we can start working on it at the earliest.You can email me at luvsohail2000@yahoo.com
Thank you.
|
|
|
|
|
Wrong site, we try and support, help coders. try rentacoder[^]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
I'm shuffling a deck of cards, but seem to keep getting more than one of the same card, after the shuffle. So, I tried quite a bit trying to set the value of the card to not equal the subnum of the card, but it didn't work. Any ideas would be much appreciated. Thanks. Here's part of the code:
Private Sub Start_Click()
Dim arrDeck(52)
Randomize
CardCount = 1
Do While CardCount < 53
arrDeck(CardCount) = -1
CardCount = CardCount + 1
Loop
CardCount = 1
Counter = 0
Do While CardCount < 53 And Counter < 53
3 CardVal = Int((52 * Rnd) + 1)
If arrDeck(CardVal) = -1 Then
arrDeck(CardVal) = CardCount
Subnum = Counter
Image1(Subnum) = Image1(CardVal)
Image1(Subnum).Visible = True
CardCount = CardCount + 1
Counter = Counter + 1
Else: GoTo 3
End If
Loop
End Sub
|
|
|
|
|
have you tried applying a number between 1 and 52 to each card, the as each number is picked randomly it is added to an array.
on the next random call, it is checked to the contents of the array, and if found to have been picked already is rejected.
It will slow doown as the cards are dealt, but then that array will be filled from 1 to 52 in random order, just apply the numbers back to the cards to give a random shuffle.
------------------------------------
"I am always serious about what I do, not necessarily about how I do it."
Tom Baker
|
|
|
|
|
Thank you; I will try this...I appreciate your time.
|
|
|
|
|
You can add your cards to a collection and then pull the cards from random positions out of that collection and add them to another collection.
Private Function GetShuffledDeck() as List(Of Integer)
Dim cards As New List(Of Integer)
For i As Integer = 0 To 51
cards.Add(i)
Next
Dim RNG As New Random()
Dim deck As New List(Of Integer)
While cards.Count > 0
Dim cardNum As Integer
cardNum = RNG.Next(0, cards.Count)
deck.Add(cards(cardNum))
cards.RemoveAt(cardNum)
End While
Return deck
End Function
|
|
|
|
|
Wow, thanks! This does make total sense, except I have one question which might be a "newbie type:" Cards.Add(i) would produce 0 -51 cards right? Then deck.Add(cards(cardNum" would produce a random ineger and remove at cardnum....since it is in the same function, then there is an end value of 52 right? It seems confusing to me on how the end value is represented in your shuffle procedure. Thanks very much for your time! You are AWESOME!
|
|
|
|
|
ymilan wrote: since it is in the same function, then there is an end value of 52 right?
I don't get what your referring to. There is a COUNT of 52 items, 0 to 51 inclusive. The reason I wrote the method this way is because you can eliminate the top part the populates Cards with 0 to 51 and just pass in a collection of cards of any order. This method would then just "shuffle" a randomized deck. For example, you could have a method that passes a deck into this shuffle method a few times, passing in the deck that was returned, to really shuffle the deck.
Also, you can create your own Card class and replace the List(Of Integer) references with List(Of Card) instead.
|
|
|
|
|
Ok, I get it now. I was thinking along those lines, but got confused. Thanks.
|
|
|
|
|
Here's a possible solution.
Note that I have not Dimmed all the variables.
It's a classic way to do shuffling of card decks.
Private Sub Start_Click()
Dim arrDeck(52)
Randomize
' Fill deck with cards in order 1 to 52
CardCount = 1
Do While CardCount <= 52
arrDeck(CardCount) = Cardcount
CardCount = CardCount + 1
Loop
' Shuufle the deck - end value (100) could be anything, bigger it is the more shuffled deck is
Counter = 0
Do While Counter <= 100
' Get two random card positions
card1 = Int((52 * Rnd) + 1)
card2 = Int((52 * Rnd) + 1)
' Swap cards at these positions
tmpCard = arrDeck(card1)
arrDeck(card1) = arrDeck(card2)
arrDeck(card2) = tmpCard
Loop
' Now output immages in order of deck
CardCount = 1
Do While CardCount <= 52
Subnum = arrDeck(CardCount)
Image1(Subnum).Visible = True
CardCount = CardCount + 1
Loop
End Sub
Regards
David R
|
|
|
|
|
I went to compile this code in MS VB and it rejected as Compile Error all the values that were not dimmed....any ideas why? Thanks in advance.
|
|
|
|
|
Hmm, seems to compile, but when I click the start button, the program hangs....any ideas?
|
|
|
|
|
Not without seeing the actual code you did and where it is called. I don't think there's anything in it that should cause a hang.
I did not Dim all the variables because I was not sure what you had already declared.
Obviously they need to be Dimmed somewhere.
Regards
David R
|
|
|
|
|
' I x'd out the lines to show what I am trying to do...
Option Explicit
Public Sub Main()
Start_Game.Show
End Sub
Private Sub Exit_Click()
MsgBox ("Thank you for playing! Good bye")
End
End Sub
Private Sub Start_Click()
Dim arrDeck(52)
Randomize
Dim Cardcount As Integer
Dim Counter As Integer
Dim Card1 As Integer
Dim Card2 As Integer
'Dim CardVal As Integer
'Dim SubNum As Integer
' Fill deck with cards in order 1 to 52
Cardcount = 1
Do While Cardcount <= 52
arrDeck(Cardcount) = Cardcount
Cardcount = Cardcount + 1
Loop
' Shuffle the deck - end value (100)
Counter = 0
Do While Counter <= 100
' Get two random card positions
Card1 = Int((52 * Rnd) + 1)
Card2 = Int((52 * Rnd) + 1)
' Swap cards at these positions
Tmpcard = arrDeck(Card1)
arrDeck(Card1) = arrDeck(Card2)
arrDeck(Card2) = Tmpcard
'CardVal = Tmpcard ? Looking for a single value out of the random cards you made...
Loop
' Now output images in order of deck
Cardcount = 1
Counter = 0
' It seems I need a counter in here for Subnum, 0-52 so it can display the cards from 0-52 slots,
' But the array of a single value out of the random cards you made need to be set to another counter,
' Right? I'm not sure...I x'd out the lines to show what I meant...
'Do While Cardcount <= 52 And Counter < 53
'If arrDeck(CardVal) = -1 Then
' arrDeck(CardVal) = Cardcount
'Image1(Cardcount) = CardVal
' Subnum = Counter
'Image1(Subnum).Visible = True
Cardcount = Cardcount + 1
'Counter = Counter + 1
' End If
Loop
End Sub
|
|
|
|