
techmanbd
Avatar/Signature-
Posts
405 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by techmanbd
-
Opening Excel file in VB.Net
techmanbd replied to NekoManu's topic in Interoperation / Office Integration
It could be you are using an excel library in VB that is not compatible with the Excel program on the computer. I had the same problem a few years back, read this thread and it may help you. Using Late Binding is what you may need. http://www.xtremedotnettalk.com/showthread.php?t=79754&highlight=excel -
In .NET you don't use msgbox. You use messagebox.show("")
-
YOu can also use length if MyStringBuilder.length = 0 then 'code here if empty End If
-
Zero, I think this is what you are looking for with getting the peak value of the sample byte Array.Sort(sample) Dim intPeakValue as Integer = sample(sample.GetUpperBound(0)) This will sort the data in the sample array, then you get the upperbound value as an integer.
-
Best Method of writing large volumes of nothing?
techmanbd replied to joe_pool_is's topic in Directory / File IO / Registry
use "cs" in the brackets instead of "vb". -
Ok thanks, I am learning the C# language and read the following in the help files. But after reading it again, I realized that that goes for the expression after the return word. Duh. :o
-
I was wondering if it is proper to use the return in a void method to get of of the method as you would use exit sub in VB. It works I know that, but is it the proper way? For example VB private sub WWWW() if intL = 0 then exit sub ' other code here is intL not 0 End Sub private void WWWW() { if(intL == 0) { return; } // other code here if intL not 0 }
-
Best Method of writing large volumes of nothing?
techmanbd replied to joe_pool_is's topic in Directory / File IO / Registry
Yes it will take along time to do the way you do it. I know this as we do log files for our automated test for days and weeks. I would make a file around 300 to 500 megabytes, then "copy as" to the file until you reach close to 16 meg. Or using a photo that is high in bytes. Then "save as" Pic1, Pic2, etc,,,, The picture way would be better I think now that I think about it. -
Hello Laura and welcome to the forum. I don't see why you are not getting the message box to show up. The only thing I can think of is look in the region "Windows Form Designer generated code" and find your TabControl1 area where it initializes and look to see if the handle is there for that method. It should look something like this this.tabInfo.SelectedIndexChanged += new System.EventHandler(this.tabInfo_SelectedIndexChanged); Also to answer your other question. If you are selecting a tab from that tab control. Look for for the selected tab like so: private void TabControl1_SelectedIndexChanged(Object sender, EventArgs e) { if(TabControl1.SelectedTab == this.tabpage2) { MessageBox.Show("Selected tab2"); } }
-
AH yes, I have the "using.." at the top. When I start a new program it put it in.
-
after "new" take the system out. It is just KeyPressEventHandler Yes, on the quote I heard it one day on Criminal Minds. When they start an episode, they do a famous quote and I heard that. I Have always thought this way, but the quote was the perfect way to say it.
-
Below is the event when doing a kepress And you will also need to change the code in Designer Code for the event handler of the test box private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { if(e.KeyChar == 13) { MessageBox.Show("ENTERED");// You code here } } Change this this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged); to this this.textBox1.KeyPress += new KeyPressEventHandler(this.textBox1_KeyPress);
-
Hello and welcome to the site.
-
I ddn't get a chance to test it, but maybe this will help DvBatch is your data view correct? DvBatch.Find(Hold_Search)
-
Dim stS as string Dim intI As Integer = (st.Split("/").Length -1)
-
I have version 2003 and I get the same thing.
-
VB6 - Microoft.VisualBasic.Compatibility
techmanbd replied to ADO DOT NET's topic in Visual Basic .NET
Also if you need to use an error catch, use the Try 'Your code Catch ex as exception 'handle error -
Thanks, yes I do see other little bugs, as when I am typing the index cursor stays in one spot while the letters are being typed. At first I kept thinking I hit something for it to go back. Unfortunatley I don't have the luxury of my company getting the latest. Plus I won't be working here too much longer as they are closing the facility and moving to China. Maybe my next job I can get the newer version.
-
Here is the following code. I have a class, and access it in my main form. Part of my class comGPIB public class comGPIB { Board brd = new Board(); Device devdev = new Device(0,0); public int iHELLO; public Device [] devGPIB = new Device[5]; public bool boolPSConnected; public enum Dev {PS=0, AGSwitch1=1, AGSwitch2=2, KeithleyMM=3};// Used for which array for devGPIB public enum PS {Agilent=0,Xantrex=1}; //Used when for which Power Supply is found on the GPIB Network } And here is the code from my main form comGPIB cGPIB = new comGPIB();// this is up at the top where my variables are private void btnPractice_Click(object sender, System.EventArgs e) { string readIt = cGPIB.readGPIB(cGPIB.devGPIB[1]); this.lblPract.Text = readIt; } When I do cGPIB. in the drop down box I can see the public integer and the public boolean variable, but not the enums I created. Now when I do this I see it and it work, by putting the namespace. int i = HBAS_PVFT_Rack.comGPIB.Dev.AGSwitch1; Is there an explanation for this? I tried reading the help files and didn't see anything on why I need the namespace for the enum in that class. Thanks,
-
I have been testing my code. And putting the return after the Try Catch still works. At least for the 2003 version. They must have done some changes. public string readGPIB(Device devGeneric) { string readIt; try { readIt = devGeneric.ReadString(); } catch { readIt = "NAN"; } return readIt; }
-
I am running 2003.
-
I am in the process of learning the C# ways, and I came across this. In VB I can do this. For the record why I use the TRY Catch is that if a device shuts down on the GPIB bus then it raises an exception and I don't want to the program to crash. Public Function GPIBWrite(ByVal devGeneric As Device, ByVal strCommand As String) As Boolean Try devGeneric.Write(strCommand) Return True Catch ex As Exception Return False End Try End Function so here is how I converted in C# public bool writeGPIB(Device devGeneric, string strCommand) { try { devGeneric.Write(strCommand); return true; } catch(Exception ex) { MessageBox.Show(ex.Message); return false; } finally { // return true; } } I tried the return in the TRY and CATCH area and I get the error "Not all codes return a value" so I figured I can put it in finally. Basically I will make a bool variable before the try and then get to finally and return it there. But then I get this error: "Control cannot leave the body of a finally clause" So if I put the return below like so, I get no error public bool writeGPIB(Device devGeneric, string strCommand) { bool boolYes; try { devGeneric.Write(strCommand); boolYes = true; } catch(Exception ex) { MessageBox.Show(ex.Message); boolYes = false; } return boolYes; } What I am afraid of here if there is an exception, it won't make it to the return. Unless in C# this does, because in VB when it goes to the catch exception portion, it exits the sub. Or would I just need to do? Finally{} Return boolYes;
-
You mean when someone actually clicks the image? If so just do like you do with a button. With your picture box on your form, double click it to add the clickable sub to your code.