# Visual Basic

 Search this forum Profile popups    Spacing RelaxedCompactTight   Noise Very HighHighMediumLowVery Low   Layout Open AllThread ViewNo JavascriptPreview   Per page 102550   Show Last VisitLast DayLast WeekLast MonthLast 3 MthsLast 6 MthsLast YearAll
 First PrevNext
 HOW TO ANSWER A QUESTION Chris Maunder 12-Jul-09 22:40
 Apologies for the shouting but this is important.   When answering a question please: Read the question carefully Understand that English isn't everyone's first language so be lenient of bad spelling and grammar If a question is poorly phrased then either ask for clarification, ignore it, or mark it down. Insults are not welcome If the question is inappropriate then click the 'vote to remove message' button Insults, slap-downs and sarcasm aren't welcome. Let's work to help developers, not make them feel stupid.   cheers, Chris Maunder   The Code Project Co-founder Microsoft C++ MVP Sign In·View Thread·Permalink
 How to get an answer to your question Chris Maunder 10-Nov-05 16:30
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. cheers, Chris Maunder   The Code Project Co-founder Microsoft C++ MVP
 econy wrote:Is the VB.NET winform application multithread or single thread?   Yes, VB.NET supports free threading.   econy wrote:if I want to use threading.timer in a VB.NET application, do I need pay attention to the MTA, or STA?   Doesn't matter unless you are doing/using something COM-related. What are you doing? A guide to posting questions on CodeProject[^] Dave Kreskowiak Sign In·View Thread·Permalink
 The resolution of System.Timers.Timer econy 17-Jun-13 7:49
 I wrote a small program, just want to test DateTime.Now and System.Timers.Timer.   I set Timer interval = 50/40, i.e 50ms/40ms   And in the timer elapsed event, call a StreamWriter.write() function, tstText = "111" & Space(11) & Format(now, "hh:mm:ss.fff ") mFileStreamWriter.Write(tstText)    But I found in the text file which stors the data, the timer resolution is 62-65 ms. 01:38:13.423 01:38:13.485 01:38:13.548 01:38:13.610 01:38:13.673 01:38:13.735 01:38:13.798 01:38:13.860 01:38:13.923    How can I make the resolution to 50ms, 40ms? or it is impossible to do it in Windows OS or any OS? Sign In·View Thread·Permalink
 Re: The resolution of System.Timers.Timer Dave Kreskowiak 17-Jun-13 8:38
 Since Windows is not a real-time operating system, and is pre-emptive, and..., and..., getting dead on timer ticks just isn't possible. You can use various tricks to get better resolution, but even those have their limits. A few people have written articles about getting 1us resolution, but nobody has proven they work beyond any doubt.   Under Windows 7 and below, depending on the hardware, the default timer resolution is +/- 15.6ms. This means that a tick will be anywhere within about a ~32ms window of when it's actually supposed to be fired. You can change the resolution down to 1ms, but it's system-wide change that effects everything running on the system, not just your app. See this[^] for more info. A guide to posting questions on CodeProject[^] Dave Kreskowiak Sign In·View Thread·Permalink
 How to set StreamWriter object be null econy 17-Jun-13 4:10
 After some operations, I want to set the StreamWrite object be NULL.   Now the code I wrote as follows:  mFileStreamWriter.Flush() mFileStreamWriter.Close() mFileStreamWriter = Nothing    But MSDN said is/isNot only used to compare the reference, not value. So = Nothing means let an object refer to Nothing, right? Sign In·View Thread·Permalink
 Re: How to set StreamWriter object be null Dave Kreskowiak 17-Jun-13 5:25
 Nothing in VB.NET is null in other languages.   You don't have to set the streamwriter to Nothing. It does nothing for you at all. A guide to posting questions on CodeProject[^] Dave Kreskowiak Sign In·View Thread·Permalink
 Use Dispose David Mujica 17-Jun-13 8:50
 Use Using Richard Deeming 17-Jun-13 9:09
 If the StreamWriter is a local variable which never escapes the current method, wrap it in a Using ... End Using[^] block. This will ensure that the Dispose method is always called, even if your code throws an exception. Using stream As Stream = File.OpenWrite("path\to\your\file.txt") Using sw As New StreamWriter(stream) ... ' NB: No need to call Flush or Close here. End Using End Using  "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer Sign In·View Thread·Permalink
 Show Opentype feature in VB.net Deeane 16-Jun-13 23:51
 Hi all...   I have a questions about opentype font ... whether we can show OpenType feature in vb.net? and if it can where I can get a tutorial and script   Thank you for reply   best wishes, dee Sign In·View Thread·Permalink
 Re: Show Opentype feature in VB.net Eddy Vluggen 17-Jun-13 0:28
 Deeane wrote:whether we can show OpenType feature in vb.net?That's possible.   Deeane wrote:and if it can where I can get a tutorial and scriptCodeProject[^]. It's in C#, but the same applies to VB. If you're having trouble translating it to VB, post again here Bastard Programmer from Hell If you can't read my code, try converting it here[^] Sign In·View Thread·Permalink
 Re: Show Opentype feature in VB.net Deeane 17-Jun-13 0:42
 Eddy Vluggen wrote:It's in C#   Are you serious? I am currently tried to make a software font preview and I really needed that script ... can you give me a link or some tutorial of that??? video the best i really need the script ... thank you for reply   All the best! Sign In·View Thread·Permalink
 Re: Show Opentype feature in VB.net Eddy Vluggen 17-Jun-13 3:02
 Deeane wrote:Are you serious? No, being friendly; otherwise I'd simply stated that you can link to the C# code from VB without translating. There's a joke-icon that is used to mark non-serious posts.   Deeane wrote:i really need the script ...I don't supply scripts, only free advice.   If you'll need help in translating it to VB, then I'm available. If you need someone to write you a script, then you'll have to wait for a good Samaritan. Bastard Programmer from Hell If you can't read my code, try converting it here[^] Sign In·View Thread·Permalink
 Re: Show Opentype feature in VB.net Deeane 17-Jun-13 17:45
 Eddy Vluggen wrote:There's a joke-icon that is used to mark non-serious posts. i apologize to write thats, I was just surprised because I've searched everywhere and have not received   Eddy Vluggen wrote:I don't supply scripts, only free advice.   If you'll need help in translating it to VB, then I'm available. If you need someone to write you a script, then you'll have to wait for a good Samaritan. i know this is maybe not free. actually i see this video http://www.youtube.com/watch?v=UhLi40eCfzU[^] and i try to write something at the richbox but opentype feature it's not active so i try to make script but i can't . i just want to create a word mini just it. it's possible for you? how much should I pay for it? Sign In·View Thread·Permalink
 Re: Show Opentype feature in VB.net Eddy Vluggen 11hrs 16mins ago
 Deeane wrote:i apologize to write thats, I was just surprised because I've searched everywhere and have not receivedNo problem.   Deeane wrote:how much should I pay for it?One can exchange ideas here, and consult each other. If you're looking to hire a coder, you'd want a site like http://www.rent-acoder.com/[^].   VB.NET is a friendly language. Take the source-files from the C#-project, throw them trough a converter like this one[^] and you'll have VB.NET code. If you don't yet have an IDE installed to write code, I'd recommend Visual Studio Express[^]. Bastard Programmer from Hell If you can't read my code, try converting it here[^] Sign In·View Thread·Permalink
 how change level? Andrea Feduzzi 11-Jun-13 21:02
 hi is it possible change the level of visualization of an shape (textbox, image, label ....)? If I've two shapes in the same position and i wanted to see the shapes behind is possible change the priority of visualization?   ps the answer is ok for VB and C# Sign In·View Thread·Permalink
 Re: how change level? Richard MacCutchan 11-Jun-13 21:41
 Set the Visible property to False to hide a control, so the one underneath gets revealed. Use the best guess Sign In·View Thread·Permalink
 Re: how change level? Bernhard Hiller 11-Jun-13 23:08
 The property to use is Opacity. See e.g. http://msdn.microsoft.com/en-us/library/fyby5ek5%28v=vs.80%29.aspx[^] Sign In·View Thread·Permalink
 Re: how change level? Dave Kreskowiak 12-Jun-13 1:43
 Re: how change level? Dave Kreskowiak 12-Jun-13 1:44
 vb.Net scrolls uncontrollably treddie 11-Jun-13 12:47
 Hi all.   For some reason, whenever I open a project in vb.Net 2010, and open a document, it scrolls uncontrollably to the bottom of the page. I can't get it to stop.   What's up. Sign In·View Thread·Permalink
 Re: vb.Net scrolls uncontrollably treddie 11-Jun-13 12:48
 Re: vb.Net scrolls uncontrollably treddie 11-Jun-13 12:48
 Re: vb.Net scrolls uncontrollably TnTinMn 11-Jun-13 15:57
 Re: vb.Net scrolls uncontrollably treddie 11-Jun-13 17:50
 LDAP queries not returning the same data David Mujica 10-Jun-13 9:59
 I have a utility which loops through our LDAP fetching all of the CN values out to a .csv file, I am validating this against an Excel document which contains our phone number list. The problem is that for some people, I do not find a LDAP entry.   I have another utility which takes as input the Username of someone and dumps out all of the attributes found in our LDAP and when I use this utility to find a person which is not listed on the main dump file, I do find him.   I wrote both utilities, so the fetching logic is very similar.   The looping utility uses: Dim de As New DirectoryEntry("LDAP://DC=us,DC=myCompany,DC=com")   ds.Filter = "(&(objectCategory=person))"   While the single user verifier uses:   Dim de As New DirectoryEntry("LDAP://DC=us,DC=myCompany,DC=com")   ds.Filter = String.Format("(SAMAccountName={0})", Me.tboxUserName.Text)   I have looked at the LDAP properties of 2 users; UserA is the guy I don't have in my .csv file and UserB who is listed in the .csv file and nothing obviously jumps out at me being different.   Where should I be looking to resolve this issue? If I can find a user directly by his username, then he should be part of the .csv export file. Right?   Thanks in advance for your guidance. Sign In·View Thread·Permalink
 Re: LDAP queries not returning the same data Richard Deeming 10-Jun-13 11:17
 The obvious place to start is the objectCategory. If you modify your second example to: ds.Filter = String.Format("(&(objectCategory=person)(SAMAccountName={0}))", Me.tboxUserName.Text) can you still find the missing user? "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer Sign In·View Thread·Permalink
 Re: LDAP queries not returning the same data David Mujica 11-Jun-13 10:25
 Tried your suggestion and the answer is YES, I could find the user with that criteria.   I'm using the following code in my "Ldap Dump" routine:    For Each sr As SearchResult In ds.FindAll()   I thought I read somewhere about getting LDAP information in "pages". Am I OK by using the above logic to extract the user list?   This is really a head scratcher. Sign In·View Thread·Permalink
 Re: LDAP queries not returning the same data Eddy Vluggen 10-Jun-13 11:19
 David Mujica wrote:ds.Filter = "(&(objectCategory=person))"Sounds like a collection of "all persons".   David Mujica wrote:(SAMAccountName={0})Sounds like a more specific collection; is there a person that's not a user? A disabled user?   http://www.ldapexplorer.com/en/manual/109050000-famous-filters.htm[^] Bastard Programmer from Hell If you can't read my code, try converting it here[^] Sign In·View Thread·Permalink
 Re: LDAP queries not returning the same data David Mujica 11-Jun-13 10:36
 By combining the objectCategory=person and SAMAccountName={0} into one filter, I am capable of finding my user.   The problem seems to be that when I loop through the LDAP, I'm not getting all of the users. Sign In·View Thread·Permalink
 Re: LDAP queries SOLVED - PageSize David Mujica 11-Jun-13 10:39
 Got it !   I added the following to my code and now the user in question is showing up in the "LDAP dump" file.    ds.PageSize = 2000   Thanks to all for replying to my post. Sign In·View Thread·Permalink
 Re: LDAP queries SOLVED - PageSize ChandraRam 11-Jun-13 19:23
 vb.Net Unfixing my edits? treddie 10-Jun-13 7:45
 Howdie.   Has anyone encountered vb.Net reversing your edits to a project? I just spent two days looking for a problem that took me so long to figure out because I had previously made some edits that I know were fixed, so I did not go back there until it was obvious the problem was there....Again! I had about 5 win32 functions that I needed to change from Private to Public, and a few ByRef that needed to be switched to ByVal. I was testing the program fine for a few days WITH THOSE FIXES ALREADY MADE, when all of a sudden I was getting odd errors that were hard to nail down":   "Cannot evaluate expression because the code of the current method is optimized."   and   "Exception of type 'System.ExecutionEngineException' was thrown."   The first error was difficult to nail down because it was silent and GetLastError() just returned 0 (function executed successfully), and the last error gives no indication of the problem source. Fortunately the last error went away with the solution to the first.   Basically what vb.Net did was change two of my Public back to Private, and switched one ByVal back to ByRef.   Very strange. Sign In·View Thread·Permalink
 Re: vb.Net Unfixing my edits? Ron Beyer 10-Jun-13 8:03
 Re: vb.Net Unfixing my edits? treddie 10-Jun-13 9:51
 Thanks for your reply, Ron.   There were no rollbacks, multiple instances open, or sandboxes running. But I have heard from somewhere along the line that some people have had a problem with making changes, and running it in the IDE and it behaving as if no changes had been made. I guess it boiled down to something involving the latest build vs. a cached build. One guy reported that even if he exited vb and came back in, the problem was still there, until he rebooted, and everything was OK. I could not reboot only because I am running a 3D rendering that must keep going.   My problem is different than those, but was wondering if they aren't related in some way. Sign In·View Thread·Permalink
 Re: vb.Net Unfixing my edits? TnTinMn 10-Jun-13 15:08
 Quote: But I have heard from somewhere along the line that some people have had a problem with making changes, and running it in the IDE and it behaving as if no changes had been made.That can happen when the source file somehow becomes post-dated in regards to your computer's time. Shutdown VS, fix the file date-time, delete the bin and obj folder contents.   How can this happen? Work on a project with someone on the other side of the world by exchanging files is how. Sign In·View Thread·Permalink
 Re: vb.Net Unfixing my edits? treddie 10-Jun-13 17:00
 NOW I KNOW WHY THAT HAPPENS! Often, I will try to finish up a project development date-version by 12:00 midnight. I do that so that my dated project folders show up consecutively in Windows Explorer. I also put the date stamp in the project name, in case I wrote the date incorrectly and it does not match up with the Windows date stamp, or if I archive a folder much later than I should have (since Windows does not preserve the original modification date of the folder when it is copied). Just an extra layer of info to help keep things organized. But if I forget to close out by 12:00am and catch it within maybe half an hour, I will set my clock back to just before midnight of the previous day, save out, then copy that project folder over to a new one with a new date stamp in the title. Sign In·View Thread·Permalink
 Re: vb.Net Unfixing my edits? Eddy Vluggen 10-Jun-13 8:20
 treddie wrote:Basically what vb.Net did was change two of my Public back to Private, and switched one ByVal back to ByRef. Very strange.I'd rather call that "unlikely" than "strange". What reason would it have to do so?   Edit it again, and have it write it's version (or anything else you'd wanna use to discriminate between your current code, and the previous) to a file, or, better yet, using OutputDebugString. Weird, spooky stuff like this can happen if part of the code is outdated, which can happen through a multitude of ways. Bastard Programmer from Hell If you can't read my code, try converting it here[^] Sign In·View Thread·Permalink
 Re: vb.Net Unfixing my edits? treddie 10-Jun-13 9:56
 I'll google "outdated code" and see what comes up. Another issue that might be related is for some reason a form will fail to refresh due to controls being "missing" when they were in fact always there. I find it odd that vb can lose track of controls on a form without me having made any edits that directly affect a control. Sign In·View Thread·Permalink
 Re: vb.Net Unfixing my edits? Eddy Vluggen 10-Jun-13 10:45
 treddie wrote:I'll google "outdated code" and see what comes up.Ah, sarcasm, the most honest forms of poetry; Google for ..   Here[^]'s the link. In short, your app might pick another assembly than you expect it to, depending on the location of the assembly, it's version and some other stuff.   treddie wrote:Another issue that might be related is for some reason a form will fail to refresh due to controls being "missing" when they were in fact always there. I find it odd that vb can lose track of controls on a form without me having made any edits that directly affect a control.It didn't, otherwise it could not claim it to be missing. It knows what control is expected, but the complaint mentions that it did not find physical code there. Or anywhere else in it's search-path. Often, it's because it's either too picky (compiled against a specific version) or not picky enough (using an older version of the assembly that's higher in the searchpath). Bastard Programmer from Hell If you can't read my code, try converting it here[^] Sign In·View Thread·Permalink
 Re: vb.Net Unfixing my edits? treddie 10-Jun-13 11:15
 Heheh...No sarcasm intended. I don't expect people to feed me on a silver platter, so I was going to go search for it on my own.   I read the article, and that seems pretty messed up. I mean, If I'm writing a program, and I have my code sitting there, it should be the only code referenced. After all, I just spent the time to edit it...I expect it to be current without some shady things going on in the background.   As an update, I forgot to mention that the form was not refreshing IN THE IDE. I'm sure you've run into that, where you click on, say, the Form1.vb [design] tab, and instead of the form popping up with all its controls, you instead get an error screen telling you something bad happened and the form can't be displayed. Sign In·View Thread·Permalink
 Re: vb.Net Unfixing my edits? Eddy Vluggen 10-Jun-13 22:34
 treddie wrote:I read the article, and that seems pretty messed up.It is   treddie wrote:As an update, I forgot to mention that the form was not refreshing IN THE IDE.The runtime still has to resolve the assembly, giving the same problems. Bastard Programmer from Hell If you can't read my code, try converting it here[^] Sign In·View Thread·Permalink
 Re: vb.Net Unfixing my edits? treddie 11-Jun-13 9:18
 Re: vb.Net Unfixing my edits? TnTinMn 10-Jun-13 15:00
 Re: vb.Net Unfixing my edits? treddie 10-Jun-13 16:48
 VB.Net and TAPI 3.1 Noname112 10-Jun-13 3:35
 Hello,   using VB.Net and TAPI 3.x I created a little application to make and recieve calls. This application uses an ordinary telephone which is connected via USB to the computer.   Most functions seem to work fine, but there are some problems which I can't solve:   - If you take the telephone receiver off the phone and then make a call via my computer application Visual Basic reports an unknown error with the code 0x80040052.   - My application don't recognizes phone events and digit events!   It would be great if someone could help me. I studied nearly everything you can find about TAPI in the internet, nevertheless I don't know how to solve these problems.   Yours faithfully, Steven Sign In·View Thread·Permalink
 checking black pixels then counting them sharief hussien VB 9-Jun-13 23:19
 Hi everyone, i am trying to write a simple code that reads a bitmap image, i.e ("c:\test.bmp"), then i would like to read every pixel and make a check if the pixel is wether a white or black pixel , to finally counting the number of black pixels in the image: my code was like this : Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim tst As New Bitmap("c:\tst.bmp") PictureBox1.Image = tst Dim x, y, bcnt As Integer Dim c As Color = tst.GetPixel(x, y) bcnt = 0 For y = 0 To tst.Height - 1 For x = 0 To tst.Width - 1 If tst.GetPixel(x, y) = Color.Black Then bcnt = bcnt + 1 End If   Next Next MsgBox(bcnt)   End Sub Sign In·View Thread·Permalink
 Re: checking black pixels then counting them Dave Kreskowiak 10-Jun-13 1:28
 I'm not seeing a question in there.   You might want to search the articles for "Image processing for dummies". You'll find articles on how to go through the image data a LOT faster than GetPixel will. A guide to posting questions on CodeProject[^] Dave Kreskowiak Sign In·View Thread·Permalink
 thank u Dave, but i did not find any thing in articles. but i will do search on the internet about " LOT " function and how to use it. any help will be appreciated. thank u in advance. Sign In·View Thread·Permalink
 Last Visit: 31-Dec-99 18:00     Last Update: 18-Jun-13 16:43 Refresh 1234567891011 Next »

Web03 | 2.6.130617.1 | Last Updated 18 Jun 2013