For those new to message boards please try to follow a few simple rules when posting your question.
Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
Keep the subject line brief, but descriptive. eg "File Serialization problem"
Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode "<" (and other HTML) characters when pasting" checkbox before pasting anything inside the PRE block, and make sure "Use HTML in this post" check box is checked.
Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
Please do not post links to your question into an unrelated forum such as the lounge. It will be deleted. Likewise, do not post the same question in more than one forum.
Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
No advertising or soliciting.
We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
Hello everyone, i've been assignt at my university to create on visual studio a personal appointment reminder visual basic. My profeccor asked me to find a code on the internet for the subject to create this project.. I searched all over the internet and i couldn't find a simple reminder code or tutorial that can help me.. Does anyone have any idea where to find such a code?
You have the wrong expectation of this forum, you need to do the work and ask specific coding questions.
Clearly define the rules for each column.
Define the rules for each aggregation.
Break the process down into smaller pieces ie. get the column headers correct then get the aggregations correct then put the data into the correct columns.
It is your problem, you cannot expect strangers to define the business rules from a bunch of data for you.
Never underestimate the power of human stupidity -
I'm old. I know stuff - JSOP
when i login 5 facebook, but i only have 1 laptop. If i use 1 web browser to login, may i have checkpoint? So this case, i open browser then change user agent, change mac address
Can you help me
This links change user agent, but only extension https://chrome.google.com/webstore/detail/user-agent-switcher-for-c/djflhoibgkdhkhhcedjiklpkjnoahfmg?hl=vi, you can see it
Thank you Richard Deeming. I decided to first try out the Excel Code (below) on Excel.
On the .Navigate command, Microfot Edge opened the site correctly
But on the While...Wend statement the code froze or raised Run-time error 462 :
"The remote server machine does not exist or is unavailable". I re-tried many times.
Dim TestString As String
TestString = "Hello world. Are you ready for us?"
MsgBox VBA_Translate(TestString, "en", "fr")
Function VBA_Translate(strSource As String, strSourceLang As String, strDestLang As String) As String
' Adopted from: http://stackoverflow.com/questions/1...text-using-vba
' Set a reference to Microsoft Internet Controls from Tools, References in VBE [OK]
' Source: http://www.vbaexpress.com/forum/showthread.php?52248-google-translator-vba-code-stop-working
' The following code is working for me.
' I have adapted, and converted to Access VBA, some Excel VBA code suggested at https://www.mrexcel.com/board/threads/google-translate-excel-vba.1079457/
' Thanks to Dossfm0q on July 24th 2020 This seems to be executing an instance of Mozilla Firefox.
' I do have Firefox installed and it's my default browser. Not sure if this is relevant.
' While I could not get Dossfm0q's code to work, I noticed that the text in objHTTP.ResponseText DID in his code in fact contain the translated text,
' and that this occurred between the string div class="result-container" just before it and /div just after it.
' so I altered his function to strResponseText() and wrote a function GetTranslatedTextFrom(ResponseText As String) As String to obtain the translated text.
' I am sure that this is less elegant than Dossfm0q's use of objHTML.getElementsByTagName("div") ,
' but since that did not work for me, I had no choice.
'Access VBA Code'--- Public Function SiftResponseText()PublicFunction GetTranslatedTextFrom(TextToTranslate AsString, FromLangCode AsString, ToLangCode AsString) AsString'input text maximum seems to be 2048 characters' REQUIRED: Set a reference to Microsoft Internet Controls from Tools/References in VBA interface'[This Function:] Identifies the translated output text by seeking the prefix <div class="result-container"> just before it and </div> just after it.'[Called by:] ' [Calls:] strResponseText()'[Example Call:] GetTranslatedTextFrom("Hello World! Are you ready for us?","en","fr") This returns : "Bonjour le monde! Êtes-vous prêt pour nous?"'[Notes:] Here are some language codes: English en, French fr, Italian it, German de , Spanish es .' Other language codes here: https://www.labnol.org/code/19899-google-translate-languages' Created: 12/14/2020 Modifications History:OnErrorGoTo Get_Err
Dim ResponseText AsStringDim GotAnError AsBoolean, PosPrefix AsLong, PosAfterPrefix AsLong, LenPrefix AsLong, PosSuffix AsLong, lenSuffix AsLongDim Prefix AsString, Suffix AsString
GotAnError = False' Get the response text from the Google translate website by calling strResponseText()
ResponseText = strResponseText(TextToTranslate, FromLangCode, ToLangCode)
' Establish the looked-for Prefix and Suffix and their lengths
Prefix = "<div class=""result-container"">"
LenPrefix = Len(Prefix)
Suffix = "</div"' the first occurring after the Prefix
lenSuffix = Len(Suffix)
' Find the Prefix and the Suffix
PosPrefix = InStr(1, ResponseText, Prefix)
If PosPrefix = 0Then MsgBox "Failed!": GoTo PreExit
PosAfterPrefix = PosPrefix + LenPrefix
PosSuffix = InStr(PosPrefix, ResponseText, Suffix)
' Get the translated text as the function's return value
GetTranslatedTextFrom = Mid(ResponseText, PosAfterPrefix, PosSuffix - PosAfterPrefix)
'If Not GotAnError then MsgBox "Success." , vbokonly , " Sub: SiftResponseText"ExitFunction' ---------------------
GotAnError = True
MsgBox str(Err) & " " & Err.Description, vbOKOnly, "Error in Sub: [SiftResponseText]"Resume PreExit
'Resume Next 'for diagnostic purposes onlyEndFunction' ==============================================PublicFunction strResponseText(strInput AsString, FrmLng AsString, ToLng AsString) AsString'[This Function:] Inputs a text, probable maximum 2048 characters, with the From-Language and the To-Language codes,' Sends a request to https://translate.google.com, and returns a response text; and returns a response text from the website.' There is probably a limit to how much use is made of this operation without Google requiring payment' Outputs a ResponseText that can be used by GetTranslatedTextFrom() to find the translated text.'[Called by:] GetTranslatedTextFrom() ' [Calls:] ' [Example Call:] RespText = strResponseText("Hello World! Are you ready for us?","en","fr")'[Notes:]'Created: 12/14/2020 Modifications History: Adapted from GgTranslate() in https://www.mrexcel.com/board/threads/google-translate-excel-vba.1079457/ originally by Dossfm0q of July 24th 2020OnErrorGoTo Goo_Err
Dim GotAnError AsBoolean
GotAnError = FalseDim strURL AsStringDim objHTTP AsObjectDim objHTML AsObjectDim objDivs AsObject, objDiv AsObjectDim strTranslated AsString' Send query to web page
strURL = "https://translate.google.com/m?hl=" & FrmLng & _
"&sl=" & FrmLng & _
"&tl=" & ToLng & _
"&ie=UTF-8&prev=_m&q=" & strInput
Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP") 'late binding
objHTTP.Open "GET", strURL, False
objHTTP.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
objHTTP.send ""' Create an html documentSet objHTML = CreateObject("htmlfile")
strResponseText = objHTTP.ResponseText
EndWith' The following text was commented out by me from Dossfm0q's code as I could not get it to work' Set objDivs = objHTML.getElementsByTagName("div") 'This looks like a div-block parsing function for objHTTP' For Each objDiv In objDivs' If objDiv.className = "t0" Then' strTranslated = objDiv.innerText' If strTranslated <> "" Then GoogTranslate = strTranslated' Msgbox "GoogTranslate="; GoogTranslate 'This never happened' End If' Next objDivSet objHTML = NothingSet objHTTP = Nothing
'If Not GotAnError then MsgBox "Success." , vbokonly , " Sub: GoogTranslate"ExitFunction' ---------------------
GotAnError = True
MsgBox str(Err) & " " & Err.Description, vbOKOnly, "Error in Sub: [GoogTranslate]"Resume PreExit
I've been using the RDLC design editor in VS 2017+ for a long time, and finally decided to ask about it.
The editor allows for multiple lines, but my expressions are always one liners. I remember in the past trying to use multiple lines but never had any luck. If there a char I need to add at the end of a line to use multiple lines?
I'm beginning to use notepad now to edit this expression.
I need to write this expression to check and make sure that the values are not 0 before I run the equation, but I'm not having any luck. I'm not sure why this expression crashes on 0's when I'm checking, it looks good to me but I'm not sure how to fix it. Maybe I should flip it around. Do the IFF and format the number in the IFF statement.
This expression compares sales in 2017 against sales in 2016, and show the percent of change.
FYTD4 is 4 years back
FYTD3 is 3 years back
On some items they are 0 because they didn't exist in those years.
I have a method Bar.
Bar take some arbitrary amount of time to complete.
I want to call Bar from a method Foo. Foo run some code sync and last run Bar async. Bar returns a value and I want Foo to return the same value.
Here is the code to reproduce the behavior:
Dim i AsInteger = Foo()
Console.Write("Enter anything: ")
EndSubAsyncFunction Foo() As Task(OfInteger)
Console.WriteLine("Do something sync")
Console.WriteLine("Do something sync")
ReturnAwait Task.Run(Function() Bar())
EndFunctionFunction Bar() AsInteger
But I get a compile error in the Main method:
Dim i AsInteger = Foo()
Value of type Task(Of Integer) cannot be converted to Integer.
I understand the error, but I don't understand how I should solve it.
I tried this line:
Dim i AsInteger = Foo().Result
Which compiles and runs. But the call to the Bar method ran sync, not async.
How should I alter the code to run Bar async and from Foo only return the value from Bar?