|
hello
I have a viewer that displays image files in wimforms. I run it from another external software and pass it file data for display in parameters to main args[].
Every time when I call the viewer I want to open the same process in order to immediately open the viewer and not close and restart.
I successful to identify the current running process and also enlarge the same Form window,
but I don't know how to perform show new Form again, So that the viewer will update the view with new files.
I mean , i have current class Process . but i need to execute Application.Run(new Form) but for current process
|
|
|
|
|
You don't need to run Application.Run again. What you do need to do is setup some kind of communication channel where the first instance of your app is listening for messages from a second instance. You can launch a second instance of your display app and when it detects that the first instance is already running, send a message over the channel so the first instance can be told what to do, like load a different file and display it.
One method of doing this is to use IpcChannel[^]
You can use a Mutex[^] to determine if your app is already running.
modified 16-Jan-23 22:04pm.
|
|
|
|
|
|
my code
If DataGridView1.Rows.Count - 1 Then
DataGridView1.Rows.Add()
DataGridView1.CurrentCell = DataGridView1.Rows(DataGridView1.Rows.Count - 1).Cells(1)
DataGridView1.BeginEdit(True)
Else
Exit Sub
' DataGridView1.Rows.Add()
End If
i many code try
If (DataGridView1.Rows.Count > 0) Then
For i = 0 To DataGridView1.Rows.Count - 1
If DataGridView1.Rows(i).Cells("d1alisname").Value = "" Then
Exit Sub
Else
DataGridView1.Rows.Add()
End If
Next
End If
but add row
|
|
|
|
|
So what exactly is the problem?
|
|
|
|
|
Sufvan Adil 2023 wrote:
If DataGridView1.Rows.Count - 1 Then Thanks to VB's "evil type coercion", that condition will be False if you have precisely one row in your grid. For any other number of rows, that condition will be True .
Sufvan Adil 2023 wrote:
For i = 0 To DataGridView1.Rows.Count - 1
If DataGridView1.Rows(i).Cells("d1alisname").Value = "" Then
Exit Sub
Else
DataGridView1.Rows.Add()
End If
Next That code walks through all the rows in your grid until it finds one where the d1alisname column is blank. For every row that it encounters where that column is not blank, it adds a new row.
You haven't explained exactly what you're trying to do. At a guess, you want to add a new row if there are either no rows in the grid, or all of the rows have a value in the d1alisname column. In which case, you need to move the "add row" code after your For loop from your second code block:
For i = 0 To DataGridView1.Rows.Count - 1
If DataGridView1.Rows(i).Cells("d1alisname").Value = "" Then
Exit Sub
End If
Next
DataGridView1.Rows.Add()
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
The following problem: Chart x-axis represents calendar weeks from 2021/35 to 2022/36 (current week 2022/19). I don't want to represent every week as a label, but only every 5th week. Up to the current week it looks relatively good, but after that every week is displayed as label.
newchart(chart1)
Dim chartArea1 As New ChartArea("Default")
chart1.AntiAliasing = AntiAliasingStyles.None
chart1.TextAntiAliasingQuality = TextAntiAliasingQuality.Normal
chart1.ChartAreas.Add(chartArea1)
chart1.ChartAreas("Default").CursorX.IsUserEnabled = False
chart1.ChartAreas("Default").CursorX.IsUserSelectionEnabled = False
chart1.ChartAreas("Default").BackGradientStyle = GradientStyle.None
chart1.ChartAreas("Default").Position.Auto = False
chart1.ChartAreas("Default").Position.X = 0
chart1.ChartAreas("Default").Position.Y = 10
chart1.ChartAreas("Default").Position.Width = ChartAreasWidth
chart1.ChartAreas("Default").Position.Height = ChartAreasHeight - 4
chart1.ChartAreas("Default").AxisX.ScaleView.Zoomable = True
chart1.ChartAreas("Default").AxisX.ScrollBar.IsPositionedInside = True
chart1.ChartAreas("Default").AxisX.MajorGrid.Enabled = False
chart1.ChartAreas("Default").AxisX.MajorGrid.LineWidth = 1
chart1.ChartAreas("Default").AxisX.IntervalType = DateTimeIntervalType.Weeks
chart1.ChartAreas("Default").AxisX.Interval = 1
chart1.ChartAreas("Default").AxisX.LabelAutoFitStyle = LabelAutoFitStyles.DecreaseFont
chart1.ChartAreas("Default").AxisX.LabelAutoFitMinFontSize = 7
chart1.ChartAreas("Default").AxisX.LabelStyle.Font = My.Settings.fontbold8
chart1.ChartAreas("Default").AxisX.LabelStyle.Angle = 90
chart1.ChartAreas("Default").AxisX.MajorTickMark.Enabled = True
chart1.ChartAreas("Default").AxisX.MinorTickMark.Enabled = False
chart1.ChartAreas("Default").AxisX.Minimum = von_X.ToOADate()
chart1.ChartAreas("Default").AxisX.Maximum = bis_X.ToOADate()
chart1.ChartAreas("Default").AxisX.IsMarginVisible = False
chart1.ChartAreas("Default").AxisY.MinorTickMark.Enabled = True
chart1.ChartAreas("Default").AxisY.MinorTickMark.TickMarkStyle = TickMarkStyle.InsideArea
chart1.ChartAreas("Default").AxisY.MajorGrid.LineWidth = 1
chart1.ChartAreas("Default").AxisY.MajorGrid.LineColor = Color.Black
chart1.ChartAreas("Default").AxisY.LabelStyle.Font = My.Settings.fontbold8
chart1.ChartAreas("Default").AxisY.LabelStyle.Format = "C0"
chart1.ChartAreas("Default").AxisY.LabelAutoFitStyle = LabelAutoFitStyles.DecreaseFont
chart1.ChartAreas("Default").AxisY.LabelAutoFitMinFontSize = 7
chart1.ChartAreas("Default").AxisY.Minimum = 0
chart1.ChartAreas("Default").AxisY2.LineDashStyle = ChartDashStyle.Solid
chart1.ChartAreas("Default").AxisY2.LineWidth = 1
chart1.ChartAreas("Default").AxisY2.LineColor = Color.Black
chart1.ChartAreas("Default").AxisY2.Enabled = AxisEnabled.True
chart1.ChartAreas("Default").AxisY2.MajorTickMark.Enabled = False
chart1.ChartAreas("Default").AxisY2.LabelStyle.ForeColor = Color.Transparent
chart1.ChartAreas("Default").AxisY2.LabelStyle.Font = My.Settings.fontbold8
chart1.ChartAreas("Default").AxisY2.MajorGrid.Enabled = False
chart1.ChartAreas("Default").AxisY2.LabelAutoFitStyle = LabelAutoFitStyles.DecreaseFont
chart1.ChartAreas("Default").AxisY2.LabelAutoFitMinFontSize = 7
chart1.ChartAreas("Default").BackColor = Color.White
|
|
|
|
|
There is no option to do this automatically.
You would have to go through the Series Points collection and clear the AxisLabel property of every data point you do not want to have a label.
|
|
|
|
|
You should be able to specify which column to use for Labels. Add an extra "label" column to your data and blank out the first 4 in every 5.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
|
Hello friends. How are you? First of all, I want to say that, I am new to this forum, and this is my first post also. I don't know this is the right place or not. But I expected that I can get better suggestions from you. Guys, I have a problem; That is, I can not solve my Windows10 stuck on loading issue. After several attempts, I had been tried my best effort but the issue is unchanged. Since I am not experienced in this matter; So I am asking you for suggestions in this regard. Can you help me somehow?
|
|
|
|
|
What is stuck on loading? You have not provided enough information about your problem
|
|
|
|
|
Thanks for replying. Whenever I was trying to start Windows10, at this time it stuck while loading. Sorry for unable to upload any screenshot for prof. But I already figure out the issue after finding this on Google. The issue if fixed after resetting the RAM and BIOS. Now it is working normally like earlier.
|
|
|
|
|
OK, for future reference, this site is about writing code.
You posted your question in a forum dedicated to writing Windows Forms apps.
|
|
|
|
|
My WinForms project has a DataGridView component which among other things shows PASS/FAIL text data.
I would like to replace any "PASS" with a check-mark image and any "FAIL" with a cross image but I'm not sure how to achieve this. Any assistance would be appreciated.
|
|
|
|
|
|
Thanks. It is working now. I first created an image column.
DataGridViewImageColumn iconColumn = new DataGridViewImageColumn();
iconColumn.HeaderText = "Pass/Fail";
iconColumn.Width = 60;
iconColumn.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
iconColumn.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
iconColumn.SortMode = DataGridViewColumnSortMode.NotSortable;
CalGrid.Columns.Insert(2, iconColumn);
I then used the CellFormatting event to set the correct image.
private void CalGrid_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
if (CalGrid[3,e.RowIndex].Value.ToString() == "PASS")
{
e.Value = imageList1.Images[0];
}
else
{
e.Value = imageList1.Images[1];
}
}
|
|
|
|
|
Use a symbol font with a larger FontSize; e.g. Wingdings.
If it's Windows 10, the MS font Segoe MDL2 Assets has the windows icons and Segoe UI Symbol are the "pre" MDL2 icons. And there's Segoe UI Emoji ✅✔☠ for color.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
I am currently writing a WinForms application in C# with a Microsoft Access database backend and using Crystal Reports for reporting.
One table in the database contains a numeric field which can allow any numeric value including zero, but is can also be Null. Currently when I display a report any field that contains a zero value is displayed as empty. I have played around with the "Show zero as" setting but it is either blank for both zero and Null values or it shows "0" for both zero and Null values.
I would like to display "0" for zero values and "" for Null values.
Any Crystal Reports gurus out there?
|
|
|
|
|
Been a while since I have used crystal reports, you will need to use a formula field. In your formula, it is also important to test IsNull first.
Crystal Syntext below,
If IsNull({Table.Field})
" "
Else
{Table.Field}
Hope this helps,
Regards,
Tarco
|
|
|
|
|
I tried this however the syntax has to be:
If IsNull({Table.Field})
" "
Else
totext({Table.Field})
Even when I do this it displays "0". For some reason CR is converting all null values to zeros.
|
|
|
|
|
If you don't mind me asking, how are you connecting to the access database?
|
|
|
|
|
I'm using c# code to connect to the database as follows:
string sql = null;
OleDbConnection cnn = new OleDbConnection(Global.connectionStringAccess);
cnn.Open();
sql = "SELECT * FROM Register WHERE ItemNo = '" + Global.CurrentItem + "'";
OleDbDataAdapter dscmd = new OleDbDataAdapter(sql, cnn);
DataSet ds = new DataSet();
dscmd.Fill(ds, "Register");
cnn.Close();
string rptName = rptPath + "\\rptWorksheet.rpt";
cryRpt.Load(rptName);
cryRpt.SetDataSource(ds.Tables["Register"]);
crystalReportViewer1.ReportSource = cryRpt;
crystalReportViewer1.Refresh();
|
|
|
|
|
|
Don't do anything complex in Crystal. Use it as a rendering engine, just allow it to do the "pretty" stuff, like grouping, totals, bolding etc. It's great for that.
Use your database to create the output values you want. In your case maybe look at creating a view and using that as your source.
// TODO: Insert something here Top ten reasons why I'm lazy
1.
|
|
|
|