|
hi everyone,
i have a datagridview with 10 column at design time. At run time i add one more column(column11) to this datagridview. Now i m unable to set the position of this column(column11). i want to show column 11 as a first column of datagridview. how can i accomplish this task in vb.net
any help will be greately appreciated.
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
|
|
|
|
|
You can try this :
'Assume dgv is your DataGridView, col is your DataGridViewColumn<br />
dgv.Columns.Insert(0, col) ' 0 is the position of first column
|
|
|
|
|
Thanks a lot.
its work.
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
|
|
|
|
|
i was debuging a line of code related to exit code.
Dim ee As Integer = System.Diagnostics.Process.Start("C:\Documents and Settings\pankaj_2\My Documents\My Completed Downloads\popup_src").ExitCode
here popup_src is the folder name
after the execution of the code , it opened the folder , but with an error message... Object reference not set to an instance of the object
|
|
|
|
|
I suspect that Process.Start returned null. That's the only place in this line that could cause that error.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
System.Diagnostics.Process.Start("C:\Documents and Settings\pankaj_2\My Documents\My Completed Downloads\popup_src")
line is executing without any error , even opening the folder.
and no object null reference error message !!!!!!!!!!!
then how should i overcome the problem that arises the null reference message in the following line
dim ee as integer=System.Diagnostics.Process.Start("C:\Documents and Settings\pankaj_2\My Documents\My Completed Downloads\popup_src").exitcode
|
|
|
|
|
The intelligent thing to do is always to check if a function returns null before trying to access the object. and, as Dave correctly pointed out, you won't get an exit code before the process ends.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
From the documentation of the Start method:
"Return Value:
A new Process component that is associated with the process resource, or a null reference (Nothing in Visual Basic), if no process resource is started (for example, if an existing process is reused)."
You can't expect the Start method to always return a reference to a Process object. You have to check if the reference is null or not, before you try to use it.
---
single minded; short sighted; long gone;
|
|
|
|
|
Or, in addition to what everyone else said, you're getting the exitcode before the process actually starts. You cannot get the exit code on the same line as the process you launched. You have to wait for the process to complete before you can get the code. Since the Process Start method is NOT a blocking call, you're not waiting for the process to complete to even give you a exit code.
|
|
|
|
|
As has been said, you won't get the exitcode at that point.
Try,
<br />
Dim myproc as new Process()<br />
myproc.StartInfo.FileName = "whatever.exe"<br />
<br />
myproc.Start()<br />
myproc.WaitForExit()<br />
Dim exitcode as Integer = proc.ExitCode<br />
If you have knowledge, let others light their candles at it.
Margaret Fuller (1810 - 1850)
|
|
|
|
|
Hi friends,
Please help me. I am creating a time scheduler in VB. It produces alarm messages at predefined time. It works. But i want to run that application on the starting of windows (log on). Please give me instructions and samples for this problem.
Thanks in advance.:->
|
|
|
|
|
|
You can put it in the 'run' key of the registry, in the 'startup' group of the start menu, or in the old, text config files that windows still uses.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
set objlistitem=lvwoutput.listitems.add(,Key & objresultset("salesid"),index1 &"",0,0)
this the syntax what we are using its fine but i want to add an extra key like
objresultset("patientName")
its possible
both this r going to refer another form to check the queries
pls help me its urgent
kankeyan
|
|
|
|
|
I don't really understand the problem. Is the problem that you need a key, but you want to store a string ? The best thing to do is to create a hash table that looks up the key, from the values you pass in ( making sure they will be unique )
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
hi Kubben,
I am still facing the same problem of dot net fraqmework dependency.
Problem is when i click my setup file , it shows the message....that it requires the .net framework 2.0.5.727
But it is added into the deployment project.
|
|
|
|
|
The only thing you can add, is a dependecy, the framework is not included in your installer, only the requirement to download it, is. I find it easier to just ship a CD that comes with a C++ program that provides a splash screen, and installs the framework before running the MSI that installs my program.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
My program works like this:
I have two forms, one is main.vb, and the other options.vb
I have three picture boxes 'picMain', 'picA' and 'picB'
I have a button 'btnOK' in the main form which you click and the options.vb form shows
i.e.
btnclick event
Dim options as new form options()
options.showdialog(me)
So far so good...
I have a few radio buttons in options.vb, and when they are checked, the images in the picture boxes in main.vb changes. My Options form has two buttons 'OK' and 'Cancel'
I put the code in the btnOK_click event
IF options.dialogresult = windows.forms.dialogresult.OK Then
If radiobutton1.checked = true then
picMain.image = picA.image
End if
If radiobutton2.checked = true then
picMain.image = picB.image
End if
End if
Nothing seems to work, the images don't change, whether I put these codes in options.vb, or the click event of the 'OK button' or main form load event. Please help!! Am I suppose to put it elsewhere? Or nested IFs don't work in this case? Thank you!!
|
|
|
|
|
Your problem seems to be that you are not passing data between the two forms correctly. You need to use either global or public variables, or use that DialogResult correctly.
To use the dialogresult correctly you would put the code in the button that shows the options form. Like this:
If Options.ShowDialog() = Windows.Forms.DialogResult.OK Then<br />
If radiobutton1.checked = true then<br />
picMain.image = picA.image<br />
End if<br />
If radiobutton2.checked = true then<br />
picMain.image = picB.image<br />
End if<br />
End if
But this won't work if the picA and picB are on the options.vb form. If the picA and picB are on the OPtions.vb page you will need to use variables or something.
I hope this helps.
|
|
|
|
|
Hmm thanks for the prompt reply! Well, my pictureboxes picA and picB are on the main form, so I dont have to put options.picA or options.picB.. this is really mind boggling because all the codes seem right but yet so wrong! Hehe
|
|
|
|
|
But the radio buttons are on the options form. That means that after you've done your show dialog you can't reference the radiobutton values because the options form is gone. You need to pass the value of your radio buttons back to the main form when the ok button is clicked by a global/public variable.
|
|
|
|
|
marshmayllow wrote: I put the code in the btnOK_click event
IF options.dialogresult = windows.forms.dialogresult.OK Then
If radiobutton1.checked = true then
picMain.image = picA.image
End if
If radiobutton2.checked = true then
picMain.image = picB.image
End if
End If
If thise code is on the Options form, it won't work. Similarly, if it's on the Main form, it wont work for different reasons.
You OK button event handler on the Options form should normally do nothing but validate the information on the form. Since all you have is a couple of radio buttons, you really should even have an event handler for the OK button.
This could should go in the section where you created and displayed the Options form:
Dim optionsForm As New OptionsForm
If optionsForm.ShowDialog() = DialogResult.Ok Then
If optionsForm.radiobutton1.checked Then
picMain.image = picA.image
End if
If radiobutton2.checked = true then
picMain.image = picB.image
End if
End If
This is only a sample of what's wrong. Depending on your requirements for functionality, there are MANY more problems with this code.
|
|
|
|
|
Your first port of call should always be to set breakpoints and step through your code, to see exactly what is going wrong. Nested 'if's obviously always work, if coded correctly.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Ok I've tried using:
Dim frmOptions As New frmOptions
frmOptions.ShowDialog(Me)
If frmOptions.ShowDialog() = Windows.Forms.DialogResult.OK Then
If radiobutton1.checked = true then
picMain.image = picA.image
End if
..etc.
This however did not work too, and instead displayed the options form again after clicking 'ok' the first time
One thing i've realised is that the code works when I put it in the mainform_load event. It just doesnt work when I put the exact codes under the btnOptions_click event. Oh no.. this is getting really strange !
|
|
|
|
|
I create and populate a dataset based on a database based on a sqlquery (da.Fill(ds, "SomeTable")).
This works great to create the columns and populate the rows, but I was hoping to also inherit the column constraints.
My end goal is to create a XSD schema object. (ds.WriteXmlSchema(“newSchemaFile.XSD”). That includes column constrants.
Thanks in advance!
Kermit
|
|
|
|