Click here to Skip to main content
15,171,053 members

Comments by MukulMohal (Top 25 by date)

MukulMohal 5-Jan-21 5:00am View
   
Yes tried this one also by converting this to vb.net but result is still same is any other way to extract a file which has special characters in the filename.
MukulMohal 27-Jun-19 2:29am View
   
i tried it but i am getting an error while making an installer in
'Flash.ocx' should be excluded because its source file 'C:\Windows\System32\Macromed\Flash\Flash.ocx' is under Windows System File Protection.


and
File 'log4net.dll' targeting 'AMD64' is not compatible with the project's target platform 'x86'
MukulMohal 26-Jun-19 7:45am View
   
no there is no message in the event viewer
MukulMohal 21-Jun-19 10:36am View
   
it even losses it data binding
MukulMohal 21-Jun-19 10:35am View
   
it gives me error like 'A column named 'Item' already belongs to this DataTable.'
MukulMohal 18-Jun-19 5:59am View
   
this is the method with which i am populating my datagridview

public void fromTOdate()
        {
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            cmd = new SqlCommand("rptSaleSearch", con);
            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.AddWithValue("@frmdt", frmdtDateTime.Text);
            cmd.Parameters.AddWithValue("@todt", todtDateTime.Text);
            cmd.ExecuteNonQuery();
            adp = new SqlDataAdapter(cmd);
            dt = new DataTable();
            adp.Fill(dt);

            grdSpanSale.DataSource = dt;
            grdSpanSale.Columns[2].Width = 50;
            grdSpanSale.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            grdSpanSale.Columns[4].Visible = true;
}
MukulMohal 18-Jun-19 4:14am View
   
when i tried using this i got the error

'Object reference not set to an instance of an object.'

(... as System.Data.DataTable) returned null.
MukulMohal 11-Jun-19 2:22am View
   
but what if it is requirement of the user?
MukulMohal 11-Jun-19 0:58am View
   
thanks Richard MacCutchan for pointing out the all these points and i was really unaware of these facts. I did improved my all points

And i was able to find out the way to resolve this issue

there was just the need to clear the command parameter.
MukulMohal 11-Jun-19 0:45am View
   
from here i learnt how to pass data from one form to another form

https://www.codeproject.com/Articles/14122/Passing-Data-Between-Forms

and i used property method to pass id from one page to another page by mannually setting the id to the property.

private void btnAddState_Click(object sender, EventArgs e)
        {
            BtnID = "btnAddState";
            using (Add add = new Add())
            {
                add.buttonID = BtnID;
                add.ShowDialog();
            }
        }
MukulMohal 10-Jun-19 9:45am View
   
in this there is one more code block in which one more stored procedure is used and i am passing a parameter to that stored procedure and stored procedure save_sale_Master is including even that parameter also. Just for that reason i am getting this error. for that can you please help me how i can do it
MukulMohal 10-Jun-19 9:45am View
   
in this there is one more code block in which one more stored procedure is used and i am passing a parameter to that stored procedure and stored procedure save_sale_Master is including even that parameter also. Just for that reason i am getting this error. for that can you please help me how i can do it
MukulMohal 10-Jun-19 8:59am View
   
added my stored procedure to the original question
MukulMohal 8-Jun-19 5:50am View
   
but how i can get the button id form one page to another page.
MukulMohal 6-Jun-19 6:47am View
   
i tried that one also using

grdsearch.datasource=dt;

and also tried

grdsearch.datasource=bindingsource1;

bothe gave me empty rows only they dont display any data in the datagridview
MukulMohal 6-Jun-19 5:48am View
   
can you please provide me the way to that.
MukulMohal 6-Jun-19 5:02am View
   
I was able to get the data from the database using

for (int i = 0; i < count; i++)
{
//dt.Rows.Add(dr[i]);
DataGridViewRow row = grdsearch.Rows[grdsearch.Rows.Add()];
grdsearch.Rows[i].Cells["Item_Description"].Value = dt.Rows[i]["Item_Description"].ToString();
grdsearch.Rows[i].Cells["HSN_Code"].Value = dt.Rows[i]["HSN_Code"].ToString();
grdsearch.Rows[i].Cells["Quantity"].Value = dt.Rows[i]["Quantity"].ToString();
grdsearch.Rows[i].Cells["Converstion_Type"].Value = dt.Rows[i]["Converstion_Type"].ToString();
grdsearch.Rows[i].Cells["Rate"].Value = dt.Rows[i]["Rate"].ToString();
grdsearch.Rows[i].Cells["Amount"].Value = dt.Rows[i]["Amount"].ToString();
grdsearch.Rows[i].Cells["Unit_Type"].Value = dt.Rows[i]["Unit_Type"].ToString();
}

now in this there is problem that when ever i am populating the grid with new data it retain the previous data and increases row again and again plz help me in getting the data properly
MukulMohal 6-Jun-19 4:11am View
   
yes i did checked, there were two rows that were returned
MukulMohal 5-Jun-19 9:53am View
   
well i was able to add two datagridviewcombobox in same datagridview by adding

HSN_Code.DisplayIndex = 1;

HSN_Code1.DisplayIndex=2;
MukulMohal 5-Jun-19 8:50am View
   
is there any way to add multiple datagridviewcombobox in same datagridview?
MukulMohal 5-Jun-19 8:29am View
   
i was able to populate the combobox1. but when i added combobox2 in the same grid it over written the combobox1. i dont know how should i go for it.

AND IN THE ABOVE CODE I JUST REPLACED

try
{
HSN_Code.DataSource = dt;
HSN_Code.HeaderText = "HSN_Code";
HSN_Code.Name = "HSN_Code";
}

with

try
{
HSN_Code.DataSource = dt1;
HSN_Code.HeaderText = "HSN Code";
HSN_Code.Name = "HSN_Code";
HSN_Code.DisplayMember = "HSN_Code";
HSN_Code.ValueMember = "Id";
}
MukulMohal 5-Jun-19 5:57am View
   
i did had a look to this solution but this is not working as in this solution columns are added from property window not programatically. and there is no code to populate datagridviewcombobox with data from data base.
MukulMohal 5-Jun-19 4:05am View
   
by CHECKING Enable Adding property of the data grid view i was able to add new row to the grid view at run time. And i want to make a grid where i can add item details along with quantity its price and total amount.
so there can be multiple rows.
MukulMohal 5-Jun-19 3:52am View
   
no i have not checked if any row exist. As my datagrid was binded to a data source so i can not add rows to the grid directly so i just added the row to datatable. Is there a way i can add row at run time to the datatable
MukulMohal 5-Jun-19 3:38am View
   
yes i did that and updated my code and i was able to navigate from 1 row to another row but that worked till 2nd row. it again throws same exception when trying to navigate from 2nd row to 3rd row.

if (grdsearch.CurrentCell.ColumnIndex == grdsearch.ColumnCount - 1)
{
col = 0;
row++;
// GO TO THE FIRST COLUMN, NEXT
grdsearch.CurrentCell =grdsearch[col,row];
}

int col = grdsearch.CurrentCell.ColumnIndex;
row = grdsearch.CurrentCell.RowIndex;

ADDED
DataRow newrow = table.NewRow();
table.Rows.Add(newrow);
IN MY GRID BIND CODE