|
Try this one;
Private Sub axWinsockListen_ConnectionRequest(ByVal requestID As Long) I wouldn't connect to many applications at once; VB6 wasn't built with multithreading support in mind.
I are Troll
|
|
|
|
|
I have 4 option buttons-
options1,options2,options3,options4
I want to add options1 and options2 in one group and options3 and option4 in another group.So that at a time one option button would be selected from each group.
How can I do this?
|
|
|
|
|
place the pairs of buttons within someother container such as a group or a panel.
Dave
Find Me On: Web| Facebook| Twitter| LinkedIn
CPRepWatcher now available as Packaged Chrome Extension, visit my articles for link.
|
|
|
|
|
Put the different groups of options buttons in separate frames
you can make the frame borders invisible if it spoils the look of the form
|
|
|
|
|
how to round this on vb.net? or how will i do this.
ex.1)
givenvalue= 3
12345 returns 12300
ex.2)
givenvalue= 4
12345 returns 12340
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
This is very simple math. In you're first example, all you do is divide the number by 100, take the integer if you don't do integer division, then multiply by 100.
|
|
|
|
|
By reading your course notes? This isn't The CodeProject Homework Hotline
Then there is what typeof rounding you want to use; http://en.wikipedia.org/wiki/Rounding[^]
See this microsoft article; How to implement custom rounding procedures[^]
One method might be to convert the number to a string, and then just work in a loop through the digits, processing as per your rounding requirements.
Other methods include working with the numbers and performing calcs on them to round.
If this isn't a homework question, it sure sounds like one!
Dave
Find Me On: Web| Facebook| Twitter| LinkedIn
CPRepWatcher now available as Packaged Chrome Extension, visit my articles for link.
modified on Wednesday, September 15, 2010 2:35 AM
|
|
|
|
|
daveauld wrote: This isn't The CodeProject Homework Hotline
You may be on to something there, but let's hide it behind a paywall and make some money!
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC League Table Link
CCC Link[ ^]
|
|
|
|
|
I wanted to know is there any technique to create a hyperlink on a field value of one of the column on the datagrid in VB6.I mean,if we click on the field value in the colunm on the datagrid,it should open the document connected to that information.Can anyone please let me know the solution?
|
|
|
|
|
Possibly, this might help,
Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
If TypeOf (DataGridView1.Columns(e.ColumnIndex)) Is DataGridViewLinkColumn Then
Process.Start(DataGridView1.Rows(e.RowIndex).Cells(e.ColumnIndex).Value)
End If
End Sub
|
|
|
|
|
Is this code applicable to VB6.How to use this code in VB6.Please explain.
|
|
|
|
|
sorry, that's the .Net way..
|
|
|
|
|
Then any idea how it can done using VB6 on a datagrid?
|
|
|
|
|
So i have a DataGridView on my form and added some columns in designtime.
When i run the application, i get an error:
No row can be added to a DataGridView control that does not have columns. Columns must be added first.
Wut? It says that the DGV has no columns, but it does! So i don't know why it says that it doesn't.
What can i do?
Hate.
Virtual Space Shuttle Astronaut
modified on Tuesday, September 14, 2010 6:09 PM
|
|
|
|
|
The Mighty Atom wrote: What can i do?
Calm down, think rationally, rerun the program inside your IDE (Visual Studio?), pay attention to all the details of the Exception, watch the linenumber, set a breakpoint, run again, look at the relevant variables, in short: debug, and earn your name.
|
|
|
|
|
It looks like the debugger is passing through a CheckedChange event of a radiobutton as i have set one to checked in designtime. Inside its sub, i have reference to another sub called PopulateGrid() which actually fills the DGV.
This happens BEFORE the form can even be seen. So my guess is that its trying to add rows to a DGV which has'nt been created yet. This is so weird. Is there a way to let it create the form first, and then let it execute the code to fill the DGV?
Virtual Space Shuttle Astronaut
|
|
|
|
|
Everything you did through Visual Designer is captured, converted to code and stored in files whose names end on designer.vb (they are part of your project, however they may be hidden somewhat, depends on some settings). This code gets called by the Form's constructor; most of what is there could:
1. have been coded by you instead of Visual Designer, and stored somewhere (say inside the constructor).
2. be postponed to a later point in time, such as the Form's Load event, the Form's Shown event, or even a button click handler (so you would have to click the button to populate the Form).
In particular, it could be wise to postpone the database access (and/or the data aspects of the DataGridView) till the Shown event.
BTW: the Designer-generated code needs a specific order, I hope you didn't mess that up earlier.
|
|
|
|
|
It makes sense because the form_load event is triggered AFTER it triggered the CheckedChanged event of the radiobutton first.
As for the designer-generated code, it did not mess with that. I never touch this code anyway.
So do i need move code or something? Like, code that'll creates the form should come BEFORE the code that creates the DGV and its columns?
Virtual Space Shuttle Astronaut
|
|
|
|
|
As I said, you could remove the code that corresponds to database accesses and/or data loading of the DGV from the Designer-generated file, and stuff it in a separate method, which you then call at your leisure, e.g. from the Shown event or a button click handler.
Alternatively, you use your observation and debugging skills to figure out why it is failing right now, and try to fix it where it is now. The problem will probably not disappear just by moving the code, so analysis and fixing will probably be required anyway (albeit may be somewhat simpler when you already see the Form's content).
|
|
|
|
|
A method is just sub right, a private sub for example?
Private sub IsMethod()
End Sub
That's a sub right?
"you could remove the code that corresponds to database accesses and/or data loading of the DGV from the Designer-generated file"
Actually, the code that fills the DGV is not in the designer generated file, it's in my form1.vb file, under its own sub called PopulateGrid().
So im still a little stuck.
Virtual Space Shuttle Astronaut
modified on Tuesday, September 14, 2010 6:58 PM
|
|
|
|
|
The Mighty Atom wrote: That's a sub right?
yes and no. The keyword says "SUB", object-oriented theory says "method" (for both Sub and Function). Not sure what VB.NET documentation calls them nowadays!
The Mighty Atom wrote: it's in my form1.vb file, under its own sub called PopulateGrid().
So where do you call this method? You can't do that before InitializeComponent in the Form's constructor (it should normally be the very first action there).
What happens when you don't call it?
|
|
|
|
|
Its calles the PopulateGrid sub from a ChangedChanged sub (of a radiobutton). It does this before i even get to see the form.
Why VB actually triggers the CheckedChanged event of the radiobutton is beyond me, it should trigger when the clicks on it, in other words, when the uses changed the checked state.
Virtual Space Shuttle Astronaut
|
|
|
|
|
OK, now I see; what happens is your Visual Designer code creates the RadioButton (as you designed it), and that causes the event to already fire, well before the DGV is ready to accept the data.
Solutions are many and easy.
1.
I suggest you undo the event linking (from RadioButton CheckedChanged event to its handler) in Visual Designer, and add a line of code at the end of your Form's constructor, it would be (best guess):
myRadioButton.AddHandler(CheckedChanged , Addressof myRadioButtonChangedHandler)
i.e. it should look exactly like the line Visual Designer did create for you (see one of those ....designer.vb files I mentioned earlier).
result: no event until the DGV is ready for accepting the data.
2.
Alternative: add a test at the top of your PopulateGrid method, skipping all action when not ready.
It probably would read:
if myDataGridView is Nothing Then Exit Sub
result: disturbing early event gets ignored.
|
|
|
|
|
if myDataGridView is Nothing Then Exit Sub
With myDataGridView being the name of my DataGridView right? In my case its called dgvRAD.
Tried that but its still producing the error. I tried your second method first becuase it's a lot simpler and easier to do. But i doesn't seem to do anything.
I debugged and noticed that it it doesn't reach Exit Sub, even though the from is still not visible and so no control is created yet. So if i understand this, myDataGridView Is Nothing and it should jump to Exit Sub, but it does'nt, its continuing jumping though the rest of the code under my PopulateGrid sub.
This is strange, don't you agree?
Virtual Space Shuttle Astronaut
|
|
|
|
|
My very first reply was:
Calm down, think rationally, rerun the program inside your IDE (Visual Studio?), pay attention to all the details of the Exception, watch the linenumber, set a breakpoint, run again, look at the relevant variables, in short: debug, and earn your name.
Did you do the linenumber part at all?
|
|
|
|