 |

|
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
|
|
|
|

|
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.
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|

|
Is the VB.NET winform application multithread or single thread?
if I want to use threading.timer in a VB.NET application, do I need pay attention to the MTA, or STA?
|
|
|
|

|
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?
|
|
|
|

|
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?
|
|
|
|

|
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.
|
|
|
|

|
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?
|
|
|
|

|
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.
|
|
|
|
|

|
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)
...
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
|
|
|
|

|
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
|
|
|
|

|
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 script CodeProject[^]. 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[^]
|
|
|
|

|
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!
|
|
|
|

|
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[^]
|
|
|
|

|
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?
|
|
|
|

|
Deeane wrote: i apologize to write thats, I was just surprised because I've searched everywhere and have not received No 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[^]
|
|
|
|

|
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#
|
|
|
|

|
Set the Visible property to False to hide a control, so the one underneath gets revealed.
Use the best guess
|
|
|
|
|

|
Opacity only works at the Form level, not controls.
|
|
|
|
|

|
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.
|
|
|
|

|
Get your damn parrot off the keyboard.
|
|
|
|
|

|
That gives a new meaning into hunt 'n peck typing.
|
|
|
|

|
Lol! There you go.
...That's a true story by the way. Happened this afternoon.
|
|
|
|

|
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.
|
|
|
|

|
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
|
|
|
|

|
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.
|
|
|
|

|
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[^]
|
|
|
|

|
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.
|
|
|
|

|
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.
|
|
|
|

|
Thanks for posting the resolution.
Happiness will never come to those who fail to appreciate what they already have. -Anon
|
|
|
|

|
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.
|
|
|
|

|
This may not be VB's fault at all, there are a couple things that could be going on...
First, if you had to do a disk repair or roll back (restore from an older version of the disk) then some disk changes may have been rolled back to old values. These roll backs can happen when you install software almost silently so its important to watch if the installer says "creating restore point".
Second, maybe you had the project open in two instances of visual studio, edited it in one, saved it, then in the other it usually says "the file changed would you like to reload" or something like that. If you don't read it quick then dismiss the dialog, make a change there and save it, it will overwrite your changes from the other instance.
Another thing is that you could have been editing the file in a sand box. Sometimes your anti-virus software incorrectly sandboxes some programs, you can make all the changes you want, compile, run, everything looks great until you exit the program and your changes aren't saved to disk. This is especially annoying and difficult to find, make sure that your antivirus hasn't sandboxed your Visual Studio instance.
Other than that, I really can't think of any reason that visual studio would "roll back" changes to your files, especially after saving them to disk.
|
|
|
|

|
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.
|
|
|
|

|
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.
|
|
|
|

|
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.
|
|
|
|

|
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[^]
|
|
|
|

|
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.
|
|
|
|

|
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[^]
|
|
|
|

|
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.
|
|
|
|

|
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[^]
|
|
|
|

|
Ahhh, but of course. Unless the compiler has a magical fix.
|
|
|
|

|
No insult intended, but never underestimate the frustration caused by pilot error when using Undo.
|
|
|
|

|
No insult taken. You may be exactly dead on correct, there, in my case!
|
|
|
|

|
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
|
|
|
|

|
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
|
|
|
|

|
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.
|
|
|
|

|
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.
|
|
|
|
 |